How to run a background command and return immediately

444 views
Skip to first unread message

Jimena Sanchez

unread,
Dec 1, 2014, 1:55:03 PM12/1/14
to rundeck...@googlegroups.com
Hi all,
I want to create a shell step that runs a command in background and returns immediately so I can continue with my next step.
I tried several approaches but the job keeps running until the background job finishes.

Here is a simple example of my problem
my shell step has these lines
echo "starting"
/tmp/test.sh
echo "done"

cat /tmp/test.sh
#!/bin/bash

/tmp/test1.sh &


cat /tmp/test1.sh
while true; do
  echo "running"
  sleep 10
done


log output shows 
starting
done
running
running
running
....


I also tried to call test1 script from rundeck's job and didn't work.

Alex Honor

unread,
Dec 1, 2014, 2:06:50 PM12/1/14
to rundeck...@googlegroups.com
Hi Jemena,

You might need to nohup the call to the test1.sh script and close stdout/stderr.

Thanks

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Alex Honor

[SimplifyOps, Inc | a...@simplifyops.com ]

Be sure to comment and vote on Rundeck Feature Development!

Jimena Sanchez

unread,
Dec 1, 2014, 7:12:46 PM12/1/14
to rundeck...@googlegroups.com
Thanks for your answer I already tried that and didn't work

Jimena Sanchez

unread,
Dec 3, 2014, 3:09:22 PM12/3/14
to rundeck...@googlegroups.com
FYI I'm running rundeck version: 2.2.1-1
Reply all
Reply to author
Forward
0 new messages