code
#!/bin/bash
EMAIL='zhangcunchao@521php.com'
start()
{
c=`ps w -C php|grep $1|wc -l`
if [ $c -lt 1 ]
then
if [ -f "$1" ];then
nohup /usr/local/php/bin/php $1 > /dev/null 2>&1 &
else
`echo 'no such file '$1 | mail -s 'process check error' $EMAIL`
fi
fi
}
BASE_PATH=`dirname $0`"/"
cd $BASE_PATH
start md_socket.php
可以监控多个进程
BASE_PATH=`dirname $0`"/"
cd $BASE_PATH
这个做到cd到脚本所在目录