upstart as cron replacement
Posted Aug 31, 2006 21:05 UTC (Thu) by
smurf (subscriber, #17840)
In reply to:
upstart as cron replacement by vmole
Parent article:
What's happening at Ubuntu: from X.org updates to upstart
init has the unique property that it gets SIGCHLD for all processes which happen to die after their parent. Thus it is able to keep track of exactly when a job is finished, even if that job daemonizes or forks itself. (For the most part.)
This means that you don't have to futz around with either putting your jobs into the background (standard /etc/init.d/* scripts) or preventing them from doing so (if you use start-stop-daemon, or some other way to catch their PID). init can keep track of the job's state and do the Right Thing, which is presumably what you've told it to do in your config file(s).
This also applies to cron jobs and the locking one might want to apply to their execution.
I don't know if you have looked at the cron code. The thing is ugly, and not just because 19-year-old code shows its age. The twenty #ifdef DEBIANs it has acquired don't exactly help either; the Debian patch, when you run it through wc -l, is larger than the original sources.
In principle, hacking support for the features Upstart offers into cron -- it could monitor the events Upstart generates, and extending the crontab syntax doesn't look to difficult -- is certainly possible, but (not only IMHO) a rewrite would be a lot cleaner. The task is too important to do it as a dirty hack.
And if you rewrite it anyway, you might as well put the task into init where it can profit from init's aforementioned special status.
(
Log in to post comments)