Files
mastering-unix-ss/chapter10/function_mon_proc_end
Fabio Scotto di Santolo 4cc88d2f6e initial commit
2020-07-28 19:28:25 +02:00

22 lines
500 B
Plaintext
Executable File

mon_proc_end ()
{
END_RC="0"
until (( END_RC != 0 ))
do
ps aux | grep -v "grep $PROCESS" | grep -v $SCRIPT_NAME \
| grep $PROCESS >/dev/null 2>&1
END_RC=$? # Check the Return Code!!
sleep 1 # Needed to reduce CPU load!
done
echo 'N' # Turn the RUN flag off
# Grab a Timestamp
TIMESTAMP=$(date +%D@%T)
echo "END PROCESS: $PROCESS ended ==> $TIMESTAMP" >> $LOGFILE &
echo "END PROCESS: $PROCESS ended ==> $TIMESTAMP" > $TTY
}