首頁  >  文章  >  後端開發  >  PHP脚本监控程序_PHP教程

PHP脚本监控程序_PHP教程

WBOY
WBOY原創
2016-07-13 10:17:161186瀏覽

PHP脚本监控程序

#!/bin/sh


# Find ip
IP=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2, index($2, ":")+1)}'`


#monitor procname scriptname
monitor()
{
	procname=$1
	scriptname=$2
	# Find proc by procname
	rc=$(ps -ef | grep $procname | grep -v grep | wc -l)
	if [ $rc -eq 0 ]; then
		echo "$procname start"
		php $scriptname &
	else
		echo "$procname running"
	fi
	sleep 1
}


#monitor proc
monitor "beanstalkd_service" "/home/www/phpxiu/public/beanstalkd_service.php"

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/894188.htmlTechArticlePHP脚本监控程序 #!/bin/sh# Find ipIP=`/sbin/ifconfig eth1 | grep inet addr | awk { print substr($2, index($2, ":")+1)}`#monitor procname scriptnamemonitor(){procname=$1script...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn