Skip to content

Instantly share code, notes, and snippets.

@beiliubei
Created July 9, 2014 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beiliubei/200f9729d02dcb5c1606 to your computer and use it in GitHub Desktop.
Save beiliubei/200f9729d02dcb5c1606 to your computer and use it in GitHub Desktop.
check and restart mono
#!/bin/sh
checkprocess()
{
if [ "$1" = "" ];
then
return 1
fi
process_num=`ps -ef |grep "$1" |grep -v "grep" |wc -l`
echo $process_num
if [ $process_num -ge 1 ];
then
return 0
else
return 1
fi
}
while [ 1 ] ; do
checkprocess "[m]ono"
check_result=$?
if [ $check_result -eq 1 ];
then
echo "not found fastcgi, begin start fastcgi-mono-server4"
nohup fastcgi-mono-server4 /applications=/:/usr/nginx/apis /socket=tcp:127.0.0.1:9000 &
echo "end start fastcgi-mono-server4"
echo `ps aux | grep '[m]ono'| awk '{print $2}'`
fi
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment