0

I am trying to setup a system where if the Linux server is going down for a restart, PHP will automatically displaying warning messages saying for example.. "Server going down for restart in X minutes". I noticed after scheduling a restart that Linux occasionally warns me about that shutdown while i'm connected to the shell. I may be working inside a shell and a message appears saying "System going down for restart in 200 minutes". Basically my question here is, how can I redirect that message to a php script that is using an event driven framework such as prggmr waiting to receive that information?

This is just the way I thought of doing this. If anyone has a better solution to this question, please let me know.

Mitch
  • 519
  • 2
  • 7
  • 16
  • 1
    From PHP, you could read from the syslog daemon but you'd need to add/modify some sort of trigger/hook within your system to call your PHP script. – Lusitanian Aug 31 '12 at 01:33
  • You can catch the termination of the PHP app itself using the pcntl library, you would want to do it on the SIGINT or SIGTERM. The only problem with this is that you must use ticks ```declare(ticks=INT)``` which dramatically affects performance, once there just run the prggmr shutdown and call an ```exit(0)```. – Nick Sep 07 '12 at 14:08

0 Answers0