Last active
December 14, 2015 21:29
-
-
Save abdallah/5151711 to your computer and use it in GitHub Desktop.
Email me when a long running process is finished
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROCESS=$1 | |
SLEEP_TIME=60 | |
EMAIL_ADDRESS=abdallah@example.com | |
while [ -n "$(pidof $PROCESS)" ]; do sleep $SLEEP_TIME; done; echo "Finished ..." | mail -s "Work finished" $EMAIL_ADDRESS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many ways to skin this cat right? Sorry pardon the grossness. May also want to check on the state of the process in case it zombies out? You can use $PID if this is embedded in the script itself
while [[ ( -d /proc/$PID ) && ( -z $(grep zombie /proc/$PID/status) ) ]]
do ...