Skip to content

Instantly share code, notes, and snippets.

@adeubank

adeubank/watchdog.sh

Created Jul 25, 2014
Embed
What would you like to do?
Bash script to watch a process and notify you with a text when it is no longer running
#!/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"
@adeubank

This comment has been minimized.

Copy link
Owner Author

@adeubank adeubank commented Jul 25, 2014

Example usage: ./watchdog.sh 4725 5555555555 "Process done."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment