Created
November 25, 2016 09:55
-
-
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
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
#!/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