Created
October 24, 2017 06:04
-
-
Save jintao-zero/7f391b66475fcd7b135a4e968ab815b5 to your computer and use it in GitHub Desktop.
check some process is running, if not start it
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
#!/usr/bin/env bash | |
# get dir | |
fullpath=$(readlink -f "$0") | |
path=$(dirname "$fullpath") | |
exec=$path/l2-proxy | |
#`ps -ef | grep "/root/l2/hsl-level2hq/client/"` | |
checkresult=$(ps -e -o cmd | grep -v "grep" | grep "$exec" | wc -l) | |
if [ $checkresult -eq 1 ]; | |
then | |
: #do nothing | |
#echo $path/ | |
else | |
echo $(date) $exec no runing, now start it | |
nohup $exec 1>>$path/1.out 2>&1 & | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment