View Single Post

  #2 (permalink)  
Old 02-11-2008, 01:39 PM
agn agn is offline
Member
User
 
Join Date: Feb 2008
My distro: OpenBSD/FreeBSD/Debian/Fedora/RHEL
Posts: 69
Rep Power: 1
agn is on a distinguished road
Default

Code:
#get process names
proc1=$(ps hc -o cmd -p $1)
proc2=$(ps hc -o cmd -p $2)

#kill 'em
kill $1 $2

#sleep for 2 mins
sleep 120

#check if they're running
( pgrep $proc1 && pgrep $proc2 ) > /dev/null

$? &&  mail -s "All OK" $users || mail -s "Needs manual restart" $users
Something like the above should work.
Reply With Quote