How can i check in a script if a certain process (PID) is still running?
e.g.
check if PID still running
if yes then keep checking
if not then echo PID has finished and send simple email
or
Check if PID is not running
echo PID not running and send simple email
else
go back and check again
Additional Info:
Mail will be a simple command that gets executed when the PID is gone, like mail -s "PID update" [email protected] <<< "PID $pid has exited on $HOSTENAME on $(date)" –
Additional info: the PID will be active for several days and so the monitoring script has to continue checking in the background for a long time