Comparing cron and systemd for task automation
Timer Time
Cron and systemd are two options for automating tasks in Linux. Which is best? That all depends…
Automation is a cornerstone of modern Linux system administration, bringing efficiency in executing repetitive tasks. In the past, the venerable and reliable cron utility was the go-to tool for automating recurring tasks. In recent years, however, a more modern alternative has emerged as a competitor to the classic cron: systemd timers. Although the systemd init system [1] has been around since 2010, setting timers through systemd still seems exotic and new to many Linux users. A large contingent of the Linux crowd never really had a problem with cron and has never seen any reason to switch. Still, systemd offers advanced features that aren't available with cron, and once you get past the learning curve, systemd timers aren't as complicated as they look. We decided it was time to compare these two powerful automation techniques side by side. We'll start with brief descriptions, then compare some of the pertinent features, and we'll end with a look at a few practical examples. If you're in need of some additional background, see the cron tutorial later in this issue.
Cron for Task Automation
Cron, derived from the Greek word "chronos" meaning time, is a time-based job scheduler in Unix-like operating systems [2]. Cron allows users to schedule commands or scripts, known as cron jobs, to run periodically at fixed times, dates, or intervals. The behavior of cron is governed by crontab (cron table) files. A crontab file is a configuration file specifying the schedule and the command you wish to execute [3]. Users can create their own crontab files, and there is typically a system-wide crontab file for administrative tasks.
The fundamental unit of cron is the cron job, which is defined by a specific syntax within the crontab file. Each line in a crontab represents a job and consists of a cron expression followed by the command to execute. The standard cron expression comprises five fields representing the minute (0-59), hour (0-23), day of the month (1-31), month (1-12 or JAN-DEC), and day of the week (0-6 or SUN-SAT). These fields are separated by spaces, and each can contain specific values, ranges, lists, or the asterisk (*) to denote all possible values within that field. For instance, * * * * /path/to/command would execute the specified command every minute.
[...]
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Debian Unleashes Debian Libre Live
Debian Libre Live keeps your machine free of proprietary software.
-
Valve Announces Pending Release of Steam Machine
Shout it to the heavens: Steam Machine, powered by Linux, is set to arrive in 2026.
-
Happy Birthday, ADMIN Magazine!
ADMIN is celebrating its 15th anniversary with issue #90.
-
Another Linux Malware Discovered
Russian hackers use Hyper-V to hide malware within Linux virtual machines.
-
TUXEDO Computers Announces a New InfinityBook
TUXEDO Computers is at it again with a new InfinityBook that will meet your professional and gaming needs.
-
SUSE Dives into the Agentic AI Pool
SUSE becomes the first open source company to adopt agentic AI with SUSE Enterprise Linux 16.
-
Linux Now Runs Most Windows Games
The latest data shows that nearly 90 percent of Windows games can be played on Linux.
-
Fedora 43 Has Finally Landed
The Fedora Linux developers have announced their latest release, Fedora 43.
-
KDE Unleashes Plasma 6.5
The Plasma 6.5 desktop environment is now available with new features, improvements, and the usual bug fixes.
-
Xubuntu Site Possibly Hacked
It appears that the Xubuntu site was hacked and briefly served up a malicious ZIP file from its download page.

