#!/bin/sh cd /var/www/html/solar-iot/api/sendCmd 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" & fi } statusFun 'cache' statusFun 'sumData' statusFun 'simCardCharge' statusFun 'totalLightTime' # statusFun 'policyCmd' statusFun 'xiuwenDataTest'