# Running long running tasks/java process

**URL:** <https://forum.ansible.com/t/running-long-running-tasks-java-process/12197>\
**Category:** Ansible Project\
**Created:** [January 12, 2013, 5:38am UTC](https://forum.ansible.com/t/running-long-running-tasks-java-process/12197 "2013-01-12T05:38:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kavin](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@Kavin](https://forum.ansible.com/u/Kavin)\
**Post date:** [January 12, 2013, 5:38am UTC](https://forum.ansible.com/t/running-long-running-tasks-java-process/12197/1 "2013-01-12T05:38:35Z")

</div>

Is it possible to run long running task without killing it, I did try async fire-forget but it still requires to enter time?

Or let me ask it this way, How do i run a java app on machines, for which i might need to change parameters when i start it off.

basically kickoff a java process (jar) with some parameters, if i wish to change it, kill the java process running and restart with new parameters. This is for our dev environment.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 12, 2013, 5:50am UTC](https://forum.ansible.com/t/running-long-running-tasks-java-process/12197/2 "2013-01-12T05:50:46Z")

</div>

I would either make an init script, or just use nohup and record/find the pod to stop it when restarting.

Brian Coca

---

<div class="post-metadata">

**Author:** ![Kavin](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@Kavin](https://forum.ansible.com/u/Kavin)\
**Post date:** [January 12, 2013, 7:07am UTC](https://forum.ansible.com/t/running-long-running-tasks-java-process/12197/3 "2013-01-12T07:07:02Z")

</div>

I actually did try command/shell both with nohup

action: shell nohup /usr/bin/java -jar kk.jar arg1 arg2 &  
action: command nohup /usr/bin/java -jar kk.jar arg1 arg2 &

It still does not seem to go to the next task, Only when i kill java on remote machine does it proceed,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 12, 2013, 2:19pm UTC](https://forum.ansible.com/t/running-long-running-tasks-java-process/12197/4 "2013-01-12T14:19:50Z")

</div>

> Is it possible to run long running task without killing it, I did try async  
> fire-forget but it still requires to enter time?

Just set the time to some very high value, like a day or two.

> Or let me ask it this way, How do i run a java app on machines, for which i  
> might need to change parameters when i start it off.
> 
> basically kickoff a java process (jar) with some parameters, if i wish to  
> change it, kill the java process running and restart with new parameters.  
> This is for our dev environment.

If you want to do something that runs forever, it seems you should  
write a service init script.

---

<div class="post-metadata">

**Author:** ![Kavin](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@Kavin](https://forum.ansible.com/u/Kavin)\
**Post date:** [January 14, 2013, 12:24am UTC](https://forum.ansible.com/t/running-long-running-tasks-java-process/12197/5 "2013-01-14T00:24:42Z")

</div>

Thank you very much, for now I will just set it as a Day and also look at writing an init script and also reading a config file, As i need to change parameters.

One last question in this thread, When i run a playbook in async mode, I do not get the job id, But i can go on the remote node and find it. Is there a way i can kill the jobs by jobid, I did try async\_status mode cleanup, But that does not kill the long running task,

Thanks for the help!!
