[net.sources] after csh script

waynet@tolerant.UUCP (Wayne Thompson) (07/24/86)

Here's a hacked version.

#! /bin/csh -f
#
# "after". 21jul86. runs a shell script after a running process has finished
# Peter S. Shenkin	 Columbia Univ. Biology Dept., NY, NY  10027
# {philabs,rna}!cubsvax!peters		cubsvax!peters@columbia.ARPA

# parse command line, and set sleep interval if not specified
if ($#argv == 3) then
	set seconds = $argv[3]
else if ($#argv == 2) then
	set seconds = 900
else
	echo 'usage: after pid shellscript [seconds, default=900 ]'
	exit
endif

# take a breather for $seconds;  check for pid;
#   when no longer found, run script ($agrv[2]), cleanup and exit
while (1)
	sleep $seconds
	if (`nice ps | awk '/^'"$argv[1]"'/ { print "1" }'` != 1) then
		$argv[2]
		exit
	endif
end
-- 
Which is worse ignorance or apathy? Who knows, who cares.

Wayne Thompson
..{bene,mordor,nsc,oliveb,pyramid,ucbvax}!tolerant!waynet

Your mission, should you decide to accept it, is to discern who is
responsible for these opinions, the poster or the company he works for.
Good luck!!