>> On Thu, 6 Oct 2011 23:12:46 +0800, 
>> lina <lina.lastn...@gmail.com> said:

L> I want to run a job after checking another job finished or not, such as
L> another job PID is 5543.  If it's finished then run newjob.sh

   If you own the other process (or you're root) you can use signal 0 to
   verify that it's still alive:

     me% sleep 60 &
     [1] 10175

     me% kill -0 10175                          [$? = 0]

     me% kill -0 10176
     kill: kill 10176 failed: no such process   [$? = 1 or 2]

   Try this:

     pid=5543  # or $1 or whatever
     while kill -0 $pid 2> /dev/null; do
         sleep 60
     done
     /path/to/newjob.sh

-- 
Karl Vogel                      I don't speak for the USAF or my company

Taxation WITH representation isn't so hot, either.        --bumper sticker


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20111007033031.57f74b...@kev.msw.wpafb.af.mil

Reply via email to