ps=`ps -efl|grep nginx|grep -v $0|grep -v grep|wc -l`
if [ $ps -eq 0 ];
then
echo -e "\n$(date '+%Y-%m-%d %H:%M:%S') start "
/etc/init.d/nginx start
echo "$(date '+%Y-%m-%d %H:%M:%S') done"
else
echo $(date +%F%n%T)
exit 0;
fi
在计划任务里创建 shell脚本