Replacing cron with mcron
Dan Nelson
dnelson at allantgroup.com
Thu Feb 9 19:12:17 PST 2006
In the last episode (Feb 09), Michael P. Soulier said:
> On 09/02/06 Iantcho Vassilev said:
> > Has anyone tried this? I even think of proposing this to the base
> > system - cron is such an old idea..
>
> What does mcron offer? My main complaints about cron are:
>
> 1. Difficult to do refined timing, like execute on the first tuesday
> of each month. I tend to use remind for this, by David Skoll.
Something like that rule could be done with a bit of shell script:
0 0 0 0 2 [ $(date +%d) -le 7 ] && real_command
For more compilcated rules you may be able to coax /usr/bin/calendar
into doing the date math. Or have cron call calendar's date parser
directly given a suitably-formatted crontab line.
> 2. It leaves synchronization up to the app, so it will happily start
> multiple instances of a job that's taking too long.
>
> To work around #2, I find something like daemontools or runit a nicer
> way to solve the problem.
Lockfile from the promail port works for me. You could probably use
/usr/bin/lockf also.
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list