# Starting filebeat from java code - filebeat service exit when the java service is closed

**URL:** <https://discuss.elastic.co/t/starting-filebeat-from-java-code-filebeat-service-exit-when-the-java-service-is-closed/230965>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 4, 2020, 12:15pm UTC](https://discuss.elastic.co/t/starting-filebeat-from-java-code-filebeat-service-exit-when-the-java-service-is-closed/230965 "2020-05-04T12:15:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blumre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blumre/32/67640_2.png) [@blumre](https://discuss.elastic.co/u/blumre)\
**Post date:** [May 4, 2020, 12:15pm UTC](https://discuss.elastic.co/t/starting-filebeat-from-java-code-filebeat-service-exit-when-the-java-service-is-closed/230965/1 "2020-05-04T12:15:58Z")

</div>

Hi,

I'm trying to start filebeat from java code using:

```auto
Runtime.getRuntime().exec("service filebeat start")

```

The filebeat start successfully but when I kill the java process it also exit

I tried:

```auto
nohup sudo service filebeat start &

```

also check using ps aux and doesn't seems the filebeat is NOT a child of the java process

filebeat log:

```auto
2020-05-04T14:53:07.641+0300 DEBUG [service] service/service.go:53 Received sigterm/sigint, stopping
2020-05-04T14:53:07.641+0300 INFO beater/filebeat.go:443 Stopping filebeat
2020-05-04T14:53:07.641+0300 INFO crawler/crawler.go:139 Stopping Crawler
2020-05-04T14:53:07.641+0300 INFO crawler/crawler.go:149 Stopping 1 inputs
2020-05-04T14:53:07.641+0300 INFO input/input.go:149 input ticker stopped
2020-05-04T14:53:07.641+0300 INFO input/input.go:167 Stopping Input: 11406884408552407199

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 1, 2020, 12:16pm UTC](https://discuss.elastic.co/t/starting-filebeat-from-java-code-filebeat-service-exit-when-the-java-service-is-closed/230965/2 "2020-06-01T12:16:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
