run-one improves automated tasks

Written for run-one by Dustin Kirkland  on 2011-02-15

It’s a safe bet that cron doesn’t rank highly on most Ubuntu users’ priority lists — in fact, I’d be surprised if a majority even know what cron is. For those who do, however, the Ubuntu 11.04 release in April promises some notable new features for cron in the form of the run-one wrapper script. Here’s the scoop.

Cron, of course, is the daemon on a Linux computer that lets users run commands at specific times on a regular basis. It can update software, back up data or send out reminders for important things such as Fido’s birthday. It can be quite handy, especially for people who aren’t good at remembering things.

Cron has been around for decades, longer than Linux itself. As Ubuntu Server developer Dustin Kirkland pointed out recently on his blog, however, a major shortcoming in the tool is its lack of built-in functionality for making sure it doesn’t start repeating a task before the first iteration of the same task has completed. In other words, cron under certain circumstances can become self-defeating, creating situations where the system wastes resources trying to do the same thing many times over, without ever having enough time to finish.

That’s why Kirkland wrote the run-one script, which checks to see if a given task is already in progress before letting cron create a needless copy of the same process.
Our Crons, Ourselves

I won’t try to pretend — and neither does Kirkland — that the run-one package revolutionizes the Ubuntu experience. Nor can I even say that I actually use cron that much on my desktop computer, other than for the tasks come configured on Ubuntu’s crontab out-of-the-box.

Where this feature will be particularly useful, however, is on servers, where cron plays a much more central role — and where redundant copies of the same process, if allowed to fester long enough, not only can be inconvenient, but also can cause mission-critical systems to crash. Monitoring tools such as Nagios can help alert server administrators to situations like these before they get out of hand, but it would be even better if the problem could be avoided altogether, which is what run-one makes possible.

As such, run-one represents a boon, however small, to Ubuntu Server Edition. True, it’s completely possible to use Dirkland’s code on other distributions, and other tools providing similar functionality exist, as commentators on Kirkland’s blog point out. But the 11.04 release of Ubuntu Server can boast that run-one comes built-in.

Will this send the masses flocking to Ubuntu Server Edition in April? On its own, probably not. But it’s one tiny improvement of the sort that, over time, adds up.

Read more

Read all announcements