ASIC/FPGA Design and Verification Out Source Services
wait for process
Occasionally we have a long process running on a linux (cygwin) machine, which may run for a few minutes or more. In that case best thing to do, is to switch to another task - code review, web browsing etc... We would like the computer, however, to notify us, when the process ends.For that, I have created a little script. It gets two parameters as input: process ID and its father process ID. The script checks every 5 seconds the existence of the process. If it does not find the process, it beeps a few times and terminates. To run it just use:perl wait_for_ps.pl Pmy_ps Pfather_of_my_ps
The script can be downloaded from:
script
While the script is a nice exercise in perl, there is a nicer way to do it in bash, which I was not aware of it in the beginning.
#while process is running echo the date and check every 10 seconds.
#When the process ends, beeps to get my attention.
while ps -p 8944 > /dev/null ; do date ; sleep 10;done; ~/bin/bip.unx
At work LSF is used to dispatch simulation jobs to servers. Since there is no direct access to a server and if I would like to get an audio or visual notification on job end, I need to find an alternative to ps.
while bjobs -w | grep "874872.*sim_reg" >/dev/null;do date ;sleep 60;done;clear;date
|