Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I invoke a script (do_something) in background via another script (do_manythings) as below.

nohup do_something &

How would I know in the parent script (do_manythings) that the job invoked (do_something) has been done?

share|improve this question
You can use 'jobs' command to see the status of the process.. it will show the process ID and the current status.. – Manisankar May 14 '15 at 23:55
up vote 5 down vote accepted

If you want to fire off a background job, do some other stuff, then stop and wait for the background job to finish, you can do

nohup do_something &
...more stuff...
wait $pid

Alternatively, you can test for the job having exited like this:

nohup do_something &
...more stuff...
ps -p $pid > /dev/null
[ $? == 1 ] && echo "it's gone, buddy!"
share|improve this answer

You can also look for start-stop-daemon (examples in /etc/init.d/) if you want to use do_something as a daemon.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.