#!/bin/sh #php solarWss.php start -d cd /var/www/html/solar-iot/websocket statusFun(){ process="${1}" count =`ps -ef |grep "${process}" |grep -v grep |grep -v sh|wc -l` echo "${process} $count" if [ $count -lt 1]; then echo "[`date +'%Y-%m-%d %T'`] process number:$count, restart it!" php "${process}.php" start -d& else php "${process}.php" restart -d fi } statusFun 'solarWss' statusFun 'loraWan915' statusFun 'policyCmd'