Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run some php file in background and monitor them , what is the best option for me ?

I have used nohup , but it is really simple an can not monitor processes well

I need only monitor which process is still alive , automatically restart , CPU usage or any useful info

share|improve this question
And what do you want to monitor - is it running/terminated, how much cpu/mem/net does it use etc.?!? Try to be more particular ... – dsmsk80 Sep 17 '13 at 11:10
I need only monitor which process is still alive , automatically restart , CPU usage or any useful info – Ata Sep 17 '13 at 11:12
What you want tto minitor after running you php file in background? – Abhishek Anand Amralkar Sep 17 '13 at 11:13
@AbhishekAnandAmralkar : is it alive , process lists , memory usage and any usefull info – Ata Sep 17 '13 at 11:24
up vote 1 down vote accepted

I would recommend you to deploy monit what is a nice utility to manage and monitor processes, files and much more. You can monitor a process and its CPU usage with such simple configuration then:

check process your_php_script
        matching "your_php_script"
        start program = "/home/user/bin/your_php_script
        stop program = "/usr/bin/pkill your_php_script
        if cpu usage > 80% for 5 cycles then restart

Briefly, it will check for a running process "your_php_script". If it's not running it will start it and if it uses more than 80% of CPU for more than 5 cycles it will restart the process (cycle/polling interval is configured in monit daemon configuration file in /etc/monit.conf).

share|improve this answer

You can try out Pandora FMS monitoring software. With this tool you can perform processes and services monitorization and also some basic monitoring (CPU, Disk, RAM,...). In fact I think that there are some plugins developed for the Apache Server in the module library.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.