February 04, 2006

Cron jobs out of control

These commands were a lifesaver to kill over nearly 200 cron jobs that were had got stuck.

 ps -e -o ppid,pid,args | awk '$1~/^144$/ {print $2}' | xargs kill
In the above example, the cron process was PID 144 so this killed all the jobs that were spawned by it.

The next step was to implement a lock mechanism to prevent a new job from starting if the last one hadn't completed.

Many thanks to WL!

Posted by stuartcw at February 4, 2006 08:39 AM
Comments