# running a command & remotely

**URL:** <https://forum.ansible.com/t/running-a-command-remotely/27053>\
**Category:** Ansible Project\
**Created:** [March 20, 2018, 1:09pm UTC](https://forum.ansible.com/t/running-a-command-remotely/27053 "2018-03-20T13:09:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhijit\_Chakraborty](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@Abhijit\_Chakraborty](https://forum.ansible.com/u/Abhijit_Chakraborty)\
**Post date:** [March 20, 2018, 1:09pm UTC](https://forum.ansible.com/t/running-a-command-remotely/27053/1 "2018-03-20T13:09:26Z")

</div>

Hi all,  
I am running a command using the command module. This is how it is

**- name: start**  
**command: /opt/eate/bin/[script.pl](http://script.pl) \>/dev/null &**

Now the problem is , after running the command, its not able to come out and i have to manually abort the playbook to come out of the execution.

How can i handle this so that after trigerring the command successfully , it exits properly ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 20, 2018, 1:23pm UTC](https://forum.ansible.com/t/running-a-command-remotely/27053/2 "2018-03-20T13:23:57Z")

</div>

use nohup to detach the tty.

In any case, it is not a good way to start backgrounded services, it  
is much better to use the init system or some other service control  
software on the target.

---

<div class="post-metadata">

**Author:** ![Mike\_Klebolt](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Klebolt](https://forum.ansible.com/u/Mike_Klebolt)\
**Post date:** [March 20, 2018, 1:26pm UTC](https://forum.ansible.com/t/running-a-command-remotely/27053/3 "2018-03-20T13:26:51Z")

</div>

Sounds like you may want to use async “fire and forget” by specifying a poll value of 0.  
[http://docs.ansible.com/ansible/latest/playbooks\_async.html](http://docs.ansible.com/ansible/latest/playbooks_async.html)
