status.sh 326 B

123456789101112131415161718
  1. #!/bin/sh
  2. cd /var/www/html/solar-iot/api/sendCmd
  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" &
  10. fi
  11. }
  12. statusFun 'idcol_sumData'