# How to run heartbeat in detached (non-interactive) mode

**URL:** <https://discuss.elastic.co/t/how-to-run-heartbeat-in-detached-non-interactive-mode/287601>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [October 25, 2021, 3:37pm UTC](https://discuss.elastic.co/t/how-to-run-heartbeat-in-detached-non-interactive-mode/287601 "2021-10-25T15:37:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SUMANT\_MISHRA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumant_mishra/32/77606_2.png) [@SUMANT\_MISHRA](https://discuss.elastic.co/u/SUMANT_MISHRA)\
**Post date:** [October 25, 2021, 3:37pm UTC](https://discuss.elastic.co/t/how-to-run-heartbeat-in-detached-non-interactive-mode/287601/1 "2021-10-25T15:37:39Z")

</div>

Hi,

I have installed heartbeat in a virtual machine in Azure Portal. I am trying to start the heartbeat from my system terminal using SSH. But if I close my terminal it stops the heartbeat that's running in my remote virtual machine.

How can I run the heartbeat remotely without keeping my terminal open in my local system?

Thanks in advance!!!

---

<div class="post-metadata">

**Author:** ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)\
**Post date:** [October 27, 2021, 2:48pm UTC](https://discuss.elastic.co/t/how-to-run-heartbeat-in-detached-non-interactive-mode/287601/2 "2021-10-27T14:48:51Z")

</div>

Hi @SUMANT_MISHRA ,

There are multiple ways to keep the process running in background even after the terminal closure.

Here is the [thread](https://unix.stackexchange.com/questions/3886/difference-between-nohup-disown-and) that goes in to detail on different ways. Hope this helps.

Thanks,  
Vignesh

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 27, 2021, 3:03pm UTC](https://discuss.elastic.co/t/how-to-run-heartbeat-in-detached-non-interactive-mode/287601/3 "2021-10-27T15:03:32Z")

</div>

Hi @SUMANT_MISHRA

The more formal way to do it is install as a package on linux or a service on windows... there are instructions for that [here](https://www.elastic.co/guide/en/beats/heartbeat/current/setup-repositories.html)

There are .dep and .rpm packages [here](https://www.elastic.co/downloads/beats/heartbeat)

`nohup` is not actually guaranteed with beats at the low level go libraries, as far as I know that is still the case, perhaps that has changed...

See Here :

> <https://github.com/elastic/beats/issues/984>
>
> I know we can do something like \`filebeat -c filebeat.yml &\`, but I'd love to ha…ve an official run option.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [November 8, 2021, 2:47pm UTC](https://discuss.elastic.co/t/how-to-run-heartbeat-in-detached-non-interactive-mode/287601/4 "2021-11-08T14:47:19Z")

</div>

++ I'd just use the packages as @stephenb recommends, which will install the correct systemd configs.

---

<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:** [December 6, 2021, 4:47pm UTC](https://discuss.elastic.co/t/how-to-run-heartbeat-in-detached-non-interactive-mode/287601/5 "2021-12-06T16:47:45Z")

</div>

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