Last active
August 29, 2015 14:19
-
-
Save noisychannel/35d009ccab805b106b9b to your computer and use it in GitHub Desktop.
Monitor a process
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
#!/usr/bin/env bash | |
if [ $# -lt 1 ]; then | |
echo "Please enter the process ID to monitor:" | |
exit 1; | |
fi | |
#TODO: Change email | |
[email protected] | |
PID=$1 | |
PNAME="$(cat /proc/$1/cmdline)" | |
while [ -e /proc/$PID ] ; do | |
sleep 30 # chage it to 30 or any other time in seconds (600 seconds=10 minutes!) | |
done | |
echo "$1 Process done" | mail -s "$PNAME process finished" $EMAIL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment