# ansible with nohup not stable

**URL:** <https://forum.ansible.com/t/ansible-with-nohup-not-stable/24188>\
**Category:** Ansible Developer\
**Created:** [April 11, 2017, 10:35am UTC](https://forum.ansible.com/t/ansible-with-nohup-not-stable/24188 "2017-04-11T10:35:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhangjie](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@zhangjie](https://forum.ansible.com/u/zhangjie)\
**Post date:** [April 11, 2017, 10:35am UTC](https://forum.ansible.com/t/ansible-with-nohup-not-stable/24188/1 "2017-04-11T10:35:59Z")

</div>

ansible is running on myMaster,and there is 14 clients（myhost1 to myhost14） to be managed.my command is like below:  
ansible myhosti -m shell -a “nohup sh /home/hadoop/calculate.sh \>\> /home/hadoop/logs/myhosti.log 2\>&1 &”

/home/hadoop/calculate.sh  
#!/bin/sh  
echo “------------------------------”  
babababbababa…

the command executes correctly mostly，sometimes i got myhosti.log，but the file myhosti.log is empty. and this happends irregularly.  
Who has encountered such a situation?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 11, 2017, 4:39pm UTC](https://forum.ansible.com/t/ansible-with-nohup-not-stable/24188/2 "2017-04-11T16:39:01Z")

</div>

Is ‘myhosti’ a group of hosts? If so, ansible will spawn a separate thread for each host, so I imagine all threads are going to write to one file, potentially overwriting each other. You could run with -f1 (just use 1 fork) to avoid this problem, or figure out a way for each host to write to its own log file.

Hope this helps,

Jon
