restart.sh 463 B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. #php solarWss.php restart -d
  3. cd /var/www/html/solar-iot/websocket
  4. statusFun(){
  5. process="${1}"
  6. count =`ps -ef |grep "${process}" |grep -v grep |grep -v sh|wc -l`
  7. echo "${process} $count"
  8. if [ $count -lt 1]; then
  9. echo "[`date +'%Y-%m-%d %T'`] process number:$count, restart it!"
  10. php "${process}.php" start -d&
  11. else
  12. php "${process}.php" restart -d
  13. fi
  14. }
  15. statusFun 'solarWss'
  16. statusFun 'loraWan915'
  17. statusFun 'policyCmd'