# How use Stop method?

**URL:** <https://discuss.elastic.co/t/how-use-stop-method/155833>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 8, 2018, 7:42am UTC](https://discuss.elastic.co/t/how-use-stop-method/155833 "2018-11-08T07:42:57Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [November 9, 2018, 8:27am UTC](https://discuss.elastic.co/t/how-use-stop-method/155833/5 "2018-11-09T08:27:14Z")

</div>

What is your use case? What do you want to automate with your code? Do you need to reload configuration if one of the files changed? Have you looked at this documentation? [https://www.elastic.co/guide/en/beats/filebeat/current/\_live\_reloading.html](https://www.elastic.co/guide/en/beats/filebeat/current/_live_reloading.html)

Filebeat is not intended to be used this way. If you really need to start and stop Filebeat from Golang I suggest you the `exec` package to start and stop: [https://golang.org/pkg/os/exec/](https://golang.org/pkg/os/exec/)

Examples:  
Starting Filebeat

```auto
cmd := exec.Command("./filebeat")
err := cmd.Start()
if err != nil {
    log.Errorf("Error while running Filebeat: %+v", err)
}

```

Stopping Filebeat

```auto
cmd.Process.Kill()

```

---

_[View the full topic](https://discuss.elastic.co/t/how-use-stop-method/155833)._
