Skip to content

Instantly share code, notes, and snippets.

@yungookim
Created October 30, 2013 14:43
Show Gist options
  • Save yungookim/7233820 to your computer and use it in GitHub Desktop.
Save yungookim/7233820 to your computer and use it in GitHub Desktop.
Watch a process, when done, send me an email.
#!/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