# Apm-server stops when i close my ssh session

**URL:** <https://discuss.elastic.co/t/apm-server-stops-when-i-close-my-ssh-session/132370>\
**Category:** APM\
**Created:** [May 17, 2018, 3:37pm UTC](https://discuss.elastic.co/t/apm-server-stops-when-i-close-my-ssh-session/132370 "2018-05-17T15:37:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Heizer](https://avatars.discourse-cdn.com/v4/letter/t/e79b87/32.png) [@Tim\_Heizer](https://discuss.elastic.co/u/Tim_Heizer)\
**Post date:** [May 17, 2018, 3:37pm UTC](https://discuss.elastic.co/t/apm-server-stops-when-i-close-my-ssh-session/132370/1 "2018-05-17T15:37:06Z")

</div>

I have apm-server installed on a ubuntu ec2 instance in AWS and it is sending output to another ubuntu ec2 instance running elasticsearch. I have the apm agent installed and working on an node.js app.

When I log into the apm-server instance and issue : **apm-server -e** it launches and connects properly. Kibana shows data from the node app and all looks great.

But if I close my ssh session to the apm-server instance, it appears that apm stops running and my node app fails do to connection refused when the apm agent tries to connect to the apm-server. As soon as i log in via ssh and run apm-server -e, all starts working again.

How do I have apm-server run persistently in the background?

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [May 18, 2018, 1:43am UTC](https://discuss.elastic.co/t/apm-server-stops-when-i-close-my-ssh-session/132370/2 "2018-05-18T01:43:48Z")

</div>

If you [install using APT](https://www.elastic.co/guide/en/apm/server/6.2/setup-repositories.html#_apt), then you should end up with a systemd service, which you can run in the background with "sudo systemctl start apm-server". Logging will go to /var/log/apm-server.

---

<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 7, 2018, 9:43pm UTC](https://discuss.elastic.co/t/apm-server-stops-when-i-close-my-ssh-session/132370/3 "2018-06-07T21:43:53Z")

</div>

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