PHP script monitoring program_PHP tutorial

WBOY
Release: 2016-07-13 10:17:16
Original
1179 people have browsed it

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"
Copy after login

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...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template