Created
November 25, 2016 09:56
-
-
Save Rocketeer007/dcaa55e10d7aa9fcf6e316ffa1715018 to your computer and use it in GitHub Desktop.
Wait for a process to start, then notify on start and stop of that 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
#!/bin/sh | |
trap "" HUP | |
PROCESS_NAME=$1 | |
shift | |
MESSAGE=$* | |
waitfor.sh "${PROCESS_NAME}" ${MESSAGE} has started | |
PROCESS_ID=`ps -fu gold | grep -v grep | grep "${PROCESS_NAME}" | grep -v $0 | sed -r "s/ +/ /g" | cut -f2 -d' ' | head -n1` | |
monitor.sh ${PROCESS_ID} ${MESSAGE} has finished | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment