![]() |
|
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
MIVA® RESOURCES: Watchdog For Runaway Miva ProcessesMiva has a built-in timeout feature that should shut down any Miva script running longer time then given by the globaltimeout parameter in the Miva configuration file. Unfortunately, it happens often that a Miva process stays hanging for unlimited time, consuming all free CPU time and slowing down other applications. I have seen myself such runaway processes on Linux and FreeBSD and heard about similar problems with Miva Empresa NT too. Normally, such a process runs in the memory as long as you do not restart the server or kill it manually. I have already seen such 'ghosts' hanging in the memory since several weeks. I used to kill the 'zombies' in a Unix shell manually. You can use the following command to view all running processes: ps aux
Some hosts disable ps in user shells, but some of them offer an alternative. For example at CI Host (and I believe that at OLM too) you can use the command 'ps2' instead. There is a column 'TIME' that shows the CPU time consumption of each process. Once you discover a Miva process that consumed more than couple of minutes, and you are sure that your Miva timeout is below that value, you may kill it manually: kill -s KILL pid
where you have to type the real pid (Process ID) of the respective process as shown in ps. After seeing more and more of runaway Miva processes, I wrote a shell watchdog script that may be regularly run as a cron job. The script sends an alert e-mail to the administrator whenever it founds a runaway Miva process. It can be easily modified to kill the process, too. If you want to use this option, please be sure to verify that the script works fine on your system and that it cannot kill any important program. Running the script in its alert mode for couple of months, to see if it does not send any false alarms, is a good precaution. The syntax for running the watchdog in cron each half an hour would be something like that: 0,30 * * * * /path/to/the/mivawdog.sh >/dev/null 2>&1
Here goes the shell script code You just need to change few variables:
|
||||||||||
|
Miva and some other terms used on this page are registerd trademarks of the Miva Corporation |