The shell script determines whether the process exists and restarts

#!/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>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326915277&siteId=291194637