Skip to content

Instantly share code, notes, and snippets.

@Rocketeer007
Created November 25, 2016 09:55
Show Gist options
  • Save Rocketeer007/dc99c417289831dd3538bbf0115c5805 to your computer and use it in GitHub Desktop.
Save Rocketeer007/dc99c417289831dd3538bbf0115c5805 to your computer and use it in GitHub Desktop.
Wait until a process matching a particular string starts, then send a notification
#!/bin/sh
trap "" HUP
PROCESS_NAME=$1
shift
MESSAGE=$*
until ps -fu $USER | grep "${PROCESS_NAME}" | grep -v grep | grep -v $0 | grep -v waitfor >/dev/null 2>&1; do
sleep 5
done
notify.sh ${MESSAGE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment