Created
January 12, 2015 01:41
-
-
Save paralleltree/dafd431673645262f7b2 to your computer and use it in GitHub Desktop.
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/sh | |
readonly target="target_name" # "abc.rb" | |
readonly execute="execution_command" # "ruby abc.rb &" or "ruby ${target} &" | |
while true | |
do | |
proc=$(ps -ef | grep ${target} | grep -v grep | wc -l) | |
if [ ${proc} = 0 ]; then | |
echo "Target process was terminated!!" | |
${execute} | |
fi | |
sleep 1m | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment