Created
July 25, 2014 00:49
-
-
Save adeubank/de806824dafe22190d7f to your computer and use it in GitHub Desktop.
Bash script to watch a process and notify you with a text when it is no longer running
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 | |
# | |
# Watchdog watches a process passed in as the first argument waits until | |
# it finishes and then sends a text message to the number provided. | |
# | |
PID=$1 | |
NUMBER=$2 | |
MESSAGE=$3 | |
while kill -0 $PID 2> /dev/null; do | |
sleep 10 | |
done | |
curl http://textbelt.com/text -d number=$NUMBER -d message="$MESSAGE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example usage: ./watchdog.sh 4725 5555555555 "Process done."