Well, thinking up on a concept for a watchdog, I came to a idea, which shall not be released.
My question here is, is it possible to automatically edit a php file using a php process?
Thank You
-- Qubic
ID:95922
May 25 2010, 6:08 am
|
|
The best watchdog in my eyes in a simple bash script that uses a while() on a command execution. The while() won't finish unless the command being executed finishes, which in the case of programs that run constantly is only after the program ends. So you simply return to the while() after it ends and your program never goes down for more than a second.
|
Nadrew wrote:
The best watchdog in my eyes in a simple bash script that uses a while() on a command execution. The while() won't finish unless the command being executed finishes, which in the case of programs that run constantly is only after the program ends. Wouldn't a ping to the world catch a hung up world that your suggested scenario does not resolve? |
A ping to a world that's hanging probably wouldn't do much good either. If it's not responding to other network actions like joining and interacting then there's a good chance it won't reply to the ping properly either.
He also didn't mention anything about this being for BYOND. For BYOND-specific stuff you can use the watchdog to keep track of CPU usage. If the usage stays above 95% or so for so long kill the process and start it over. World that are 'hung up' tend to use 100% CPU. |
Nadrew wrote:
If it's not responding to other network actions like joining and interacting then there's a good chance it won't reply to the ping properly either. Exactly what I meant. If there is no reply to a ping from the same server (thus little network latency involved), ungracefully kill and re-spawn. |
Schnitzelnagler wrote:
Nadrew wrote: I had mentioned this before, possibly using Mobius' and Crispy's PHP to DM comminication system, but I think the idea was turned down somewhere inbetween. |
This is by no means a good way to implement a watchdog though. The launching process should create a separate thread, which constantly tests the application to be watched and if found missing spawn the application again.
There is no need to dynamically edit a file in all of this, nor is it a desirable action.