PHP script monitoring program and script Monitoring Program

Source: Internet
Author: User

PHP script monitoring program and script Monitoring Program

#!/bin/sh# Find ipIP=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2, index($2, ":")+1)}'`#monitor procname scriptnamemonitor(){procname=$1scriptname=$2# Find proc by procnamerc=$(ps -ef | grep $procname | grep -v grep | wc -l)if [ $rc -eq 0 ]; thenecho "$procname start"php $scriptname &elseecho "$procname running"fisleep 1}#monitor procmonitor "beanstalkd_service" "/home/www/phpxiu/public/beanstalkd_service.php"


How to implement real-time file monitoring in php

Create a PHP script on the server as needed.
Let's guess if you want to detect the second problem to avoid repeated triggering of this script.

In fact, it is not recommended to trigger this script by user behavior, whether it is server code or client asynchronous Ajax.
If you want to use the PHP script for continuous loop monitoring, contact the O & M personnel and start the server, that is, start running the script on the server, and they will provide you with a solution.

We recommend that you do not use a PHP script to monitor the server using cyclic code whenever possible.
I have to admit that the stability of PHP in this aspect is still relatively poor. Java may be able to do so, and PHP will be more painful.
It is possible to ask the O & M personnel for help to inform the monitoring logic, and then ask him to install various Triggering Conditions to call the corresponding PHP code.

If you insist on using the PHP script for related work, we have two suggestions for you:
Release resources as soon as possible, no matter what resources are used by the script, including files, memory, databases, etc., as soon as possible, such a place can never be lazy, otherwise it will be self-abuse.
In this script, the independent manual log output is performed, and the entries of any layer of loops must be recorded, so that you can find the problem only when the monitoring fails.


Can the php program control the work prompted in the pop-up box of the exe file at a certain time?

1. PHP can control the pop-up of the EXE file at a certain time, but cannot control the execution process of the EXE file. That is to say, PHP can set a certain period of time to call the EXE file, but cannot control the content of the EXE execution;

2. Make it simpler:
Php can call an external exe program. If the program is executed on the server side, the exec function is used.
Note: php is a server-side script. Therefore, you cannot execute the server-side program on the client.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.