#!/bin/bash
shellPath=/www/_www/ysgame/tools/guard/shell/smstart.sh
#shellProcessCount=$(ps aux|grep "${shellPath}"|grep -v "grep"|grep -v "vim"|grep -v "vi"|wc -l)
##脚本数量大于2,结束脚本重新运行
#if [ "$shellProcessCount" -gt 2 ]; then
#    processList=`ps aux|grep "${shellPath}"|grep -v "grep"|awk '{print $2}'`
#    for pid in $processList
#    do
#        kill -9 $pid
#    done
#fi
#nohup ${shellPath}  >> /www/_www/ysgame/log/nohup_smstart.log 2>&1 &
#echo "启动成功"

processList=`ps aux|grep "${shellPath}"|grep -v "grep"|awk '{print $2}'`
if [ "$processList" = "" ]; then
    nohup ${shellPath}  >> /datasdc/logs/ysgame/log/nohup_smstart.log 2>&1 &
    echo "启动成功"
else
  echo "脚本已经在运行，请勿重复运行"
fi