Load back down

Matts on 2003-10-24T06:54:49

As suspected, something fishy was wrong.

I had a cron job that didn't exit. So I had about 300 copies of it running. And of course it was running perl, so it used quite a bit of RAM.

Strange that cron doesn't set an alarm.

My load is back to a healthy 2.0 ;-) Unfortunately I know why it's that high (a super sekrit work project - mail me privately if you want to know exactly what) and don't see any way to get it down.


single instance!

echo on 2003-10-24T11:10:01

I've been bitten by this so many times in the past that I now never ever write a cronjob without inserting a few lines of code that ensure that no previous instance of the cronjob is running, and sends me mail if it's the case.

Re:single instance!

Dom2 on 2003-10-24T12:14:11

FreeBSD has a nice program called lockf(1) for dealing with similiar situations. It just grabs a lock, runs a command and releases the lock. very handy.

-Dom

Re:single instance!

IlyaM on 2003-10-24T15:46:44

There exist CPAN modules like Proc::Pidfile, Proc::PID::File and probably other which help to assure you don't run more that one instance of the process. I used one of them in the past but forgot which one so cannot recommend any of them.