# SIGHUP sent using ansible ?

**URL:** <https://forum.ansible.com/t/sighup-sent-using-ansible/16516>\
**Category:** Ansible Project\
**Created:** [October 15, 2014, 11:39am UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516 "2014-10-15T11:39:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alain\_Kreienbuhl](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@Alain\_Kreienbuhl](https://forum.ansible.com/u/Alain_Kreienbuhl)\
**Post date:** [October 15, 2014, 11:39am UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516/1 "2014-10-15T11:39:08Z")

</div>

Hello,

I’m very puzzled by the following:

using regular ssh I’m not getting SIGHUP at the end.  
using ansible SIGHUP get’s sent : strace output :

0x7f34a666c9d0, tls=0x7f34a666c700, child\_tidptr=0x7f34a666c9d0) = 600  
futex(0x7f34a666c9d0, FUTEX\_WAIT, 600, NULL) = ? ERESTARTSYS (To be restarted)  
— SIGHUP (Hangup) @ 0 (0) —  
+++ killed by SIGHUP +++

This is using an adhoc commands such :  
-m shell -a “sudo /etc/init.d/myservice start”  
-m shell -a “/etc/init.d/myservice start” -s

-m shell -a “/etc/init.d/myservice start” -s -c ssh

I’ve tried -c ssh but behavior is unchanged.  
I’m aware of the service module. But this is just an example.  
The funny thing is that when using the service module no SIGHUP gets send

My shell (bash) has “huponexit off” off couse.

What is happening here ? Is this the excepted behavior ?

I’m using ansible (1.7.1) paramiko (1.15.0) ( upgraded paramiko to (1.15.1) same result )

Thanks for your help. I’m kind of lost on this.

Alain

---

<div class="post-metadata">

**Author:** ![John\_Favorite](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@John\_Favorite](https://forum.ansible.com/u/John_Favorite)\
**Post date:** [October 15, 2014, 2:03pm UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516/2 "2014-10-15T14:03:05Z")

</div>

My guess would be the fire and forget nature of using the shell command. If you ran ‘/usr/sbin/myprogram -C /etc/myconfig/myprogram.conf’ it would die on exit. I’m curious why you need it instead of just doing:

```auto
- service: name=httpd state=started

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Scott\_Sturdivant](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@Scott\_Sturdivant](https://forum.ansible.com/u/Scott_Sturdivant)\
**Post date:** [October 15, 2014, 2:14pm UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516/3 "2014-10-15T14:14:17Z")

</div>

FWIW, I too saw SIGHUPs as noted in this issue: [https://github.com/ansible/ansible/issues/3063](https://github.com/ansible/ansible/issues/3063)

My resolution? I just patched supervisord to handle it better (now fixed in later releases), so your best bet may to find a workaround.

---

<div class="post-metadata">

**Author:** ![Alain\_Kreienbuhl](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@Alain\_Kreienbuhl](https://forum.ansible.com/u/Alain_Kreienbuhl)\
**Post date:** [October 17, 2014, 5:01pm UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516/4 "2014-10-17T17:01:16Z")

</div>

Yes I’ve seen the same issues. I think there’s something doing on here. There’s a similar post in this forum here : [https://groups.google.com/d/msg/ansible-project/wf-UOtPOuKk/og0hVgL4xOoJ](https://groups.google.com/d/msg/ansible-project/wf-UOtPOuKk/og0hVgL4xOoJ)

So supervisord is not the issue there. How it is possible use ssh directly the -c ssh didn’t quite helpful.

Thanks

---

<div class="post-metadata">

**Author:** ![Florian\_Gysin](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@Florian\_Gysin](https://forum.ansible.com/u/Florian_Gysin)\
**Post date:** [January 8, 2015, 9:27am UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516/5 "2015-01-08T09:27:30Z")

</div>

I seem to have the same issue when trying to start Weblogic server instances via the shell command (I have to use that for complicated reasons).  
After successfully starting the server Ansible sends a SIGHUP and the server shuts down again. ☹

---

<div class="post-metadata">

**Author:** ![Tomasz\_Kontusz](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@Tomasz\_Kontusz](https://forum.ansible.com/u/Tomasz_Kontusz)\
**Post date:** [January 8, 2015, 6:24pm UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516/6 "2015-01-08T18:24:34Z")

</div>

Try sudo /etc/init.d/myservice start && sleep 2. Some services don’t isolate themselves properly on time.  
Ansible drops the ssh session the millisecond it’s not needed anymore, so those service might catch a SIGHUP.

Florian Gysin [flo.g@bluewin.ch](mailto:flo.g@bluewin.ch) napisał:

---

<div class="post-metadata">

**Author:** ![Florian\_Gysin](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@Florian\_Gysin](https://forum.ansible.com/u/Florian_Gysin)\
**Post date:** [January 9, 2015, 9:09am UTC](https://forum.ansible.com/t/sighup-sent-using-ansible/16516/7 "2015-01-09T09:09:35Z")

</div>

I resorted to calling **nohup myservice** which solved the problem, although I’ll give the sleep a try as well.
