shell脚本判断进程是否存在并重启

#!/bin/bash
#
cd /opt/rms/mobileServer
export PATH=/opt/rms/nodejs010/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib:$LD_LIBRARY_PATH

count=`ps -ef |grep mobileServer.js |grep -v "grep" |wc -l`
# echo $?
echo $count
if [ $count -eq 0  ] ; then
      echo "start process......"
     # cd /opt/rms/mobileServer
      #scl enable nodejs010 bash
     # export PATH=/opt/rms/nodejs010/bin:$PATH
      echo "start to run command.."
     # export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib:$LD_LIBRARY_PATH
      nohup  node  /opt/rms/mobileServer/mobileServer.js &
      echo "commands finished..."
else
        echo "runing..."
  fi

engrmsapptst1:/home/engrms>

猜你喜欢

转载自maxer025.iteye.com/blog/2289204
今日推荐