crontab(5) enhancements

Artem Naluzhnyy tut at nhamon.com.ua
Wed Nov 26 10:25:33 PST 2008


Hi,

I have two suggestion for newsyslog(8) and periodic(8) entries in
default /etc/crontab file:

* nice(1) newsyslog and periodic entries to shape CPU load spikes;
* lockf(1) them to prevent simultaneous execution.

So instead
  1 3 * * * root periodic daily
there may be
  1 3 * * * root lockf -t0 /var/run/periodic.daily.lock nice -20 periodic daily

In case of collision we'll receive following email:

Date: Wed, 26 Nov 2008 18:16:00 +0200 (EET)
From: root at tut.at.home (Cron Daemon)
To: root at tut.at.home
Subject: Cron <root at tut> lockf -t0 /var/run/periodic.daily.lock nice
-20 periodic daily

lockf: /var/run/periodic.daily.lock: already locked


The configuration has been working for years on my servers without any
visible drawbacks.

What do you think?

-- 
Artem Naluzhnyy


More information about the freebsd-hackers mailing list