# Async tasks running Bash scripts with background jobs

**URL:** <https://forum.ansible.com/t/async-tasks-running-bash-scripts-with-background-jobs/20127>\
**Category:** Ansible Project\
**Created:** [January 5, 2016, 11:51am UTC](https://forum.ansible.com/t/async-tasks-running-bash-scripts-with-background-jobs/20127 "2016-01-05T11:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomasz\_Kuchta](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@Tomasz\_Kuchta](https://forum.ansible.com/u/Tomasz_Kuchta)\
**Post date:** [January 5, 2016, 11:51am UTC](https://forum.ansible.com/t/async-tasks-running-bash-scripts-with-background-jobs/20127/1 "2016-01-05T11:51:33Z")

</div>

Hi All,  
I have an async command that is invoking a Bash script.  
The script invokes some other scripts in background (using “&”).  
I have noticed that the background command is either not called or it terminates immediately (not sure).  
The same script works in non-asynchronous mode (using the shell module) - the background jobs are controlled,  
so I would terminate them before the script finishes.  
It seems to me that this might have something to do with the fact that async tasks are run differently.  
Is is an expected behaviour or I should be able to run background tasks like this?

Thanks!

---

<div class="post-metadata">

**Author:** ![Tomasz\_Kuchta](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@Tomasz\_Kuchta](https://forum.ansible.com/u/Tomasz_Kuchta)\
**Post date:** [January 5, 2016, 6:44pm UTC](https://forum.ansible.com/t/async-tasks-running-bash-scripts-with-background-jobs/20127/2 "2016-01-05T18:44:29Z")

</div>

My bad - the background job is actually running - I just needed to use absolute paths.  
Sorry for confusion.
