Created
October 30, 2013 14:43
-
-
Save yungookim/7233820 to your computer and use it in GitHub Desktop.
Watch a process, when done, send me an email.
This file contains hidden or 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
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage <PID> <email address>" | |
fi | |
if kill -0 $1; then | |
echo "Process $1 doesn't exist." | |
exit 1 | |
fi | |
while kill -0 $1; do | |
sleep 10 | |
done | |
echo "Process $1 finished at $(date +"%F %T")." | mail -s "Email Notification" $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment