# Ansible Fails to Restart Jetty on a remote host

**URL:** <https://forum.ansible.com/t/ansible-fails-to-restart-jetty-on-a-remote-host/31362>\
**Category:** Ansible Project\
**Created:** [September 25, 2019, 1:58pm UTC](https://forum.ansible.com/t/ansible-fails-to-restart-jetty-on-a-remote-host/31362 "2019-09-25T13:58:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madushan\_Chathuranga](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Madushan\_Chathuranga](https://forum.ansible.com/u/Madushan_Chathuranga)\
**Post date:** [September 25, 2019, 1:58pm UTC](https://forum.ansible.com/t/ansible-fails-to-restart-jetty-on-a-remote-host/31362/1 "2019-09-25T13:58:24Z")

</div>

Hi All,

I’m trying to restart jetty using an ansible script

bellow is a snippet from my script

`

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [September 25, 2019, 2:02pm UTC](https://forum.ansible.com/t/ansible-fails-to-restart-jetty-on-a-remote-host/31362/2 "2019-09-25T14:02:03Z")

</div>

probably because you have sh on the command. Probably better if you pass the whole directory to jetty.sh restart. Like /apps/servers/jetty/bin/jetty.sh restart

---

<div class="post-metadata">

**Author:** ![astrakid](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/astrakid/32/1789_2.png) [@astrakid](https://forum.ansible.com/u/astrakid)\
**Post date:** [September 25, 2019, 2:29pm UTC](https://forum.ansible.com/t/ansible-fails-to-restart-jetty-on-a-remote-host/31362/3 "2019-09-25T14:29:57Z")

</div>

i think it is because the process is started within the ssh session opened by ansible, and if you close the session, the subprocesses will be stopped as well.

2 solutions:

1. use a system-service to restart jetty (don’t know if it exists; maybe jetty.sh is doing this already, then the solution from jonathan would solve it))
2. use nohup at beginning of the command, to start the process outside of your ssh-session.

regards,  
andre
