status.sh 416 B

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