Cron is a UNIX utility function that allows users to schedule and automate various execution processes (scripts, commands, or programs) within their systems. Cron is a background process (daemon) that needs to be started only once. It works by examining the cron list (cron table/crontab) and checking if any scheduled activity needs to be executed. If there is, it executes it. If not, it sleeps for another specified interval. Since its release, cron has become the de facto tool in Linux-based operating systems for task scheduling.
Cron jobs are often used for scheduling repetitive operations. For example, a cron job might execute a script that sends emails to users on a specific day. Since these jobs are highly customizable, you can do things like set a cron job to run every 30 minutes or only run on Mondays and Tuesdays.
While cron is a popular tool, it can be difficult to use, especially at scale. If you're looking for alternatives, there are several with different benefits on the market. In this article, we’ll cover several cron alternatives and see how they differ from each other in order to help you decide which task scheduler best suits your needs. The cron alternatives we'll cover in detail are:
- Airplane schedules
We landed on these six because they're easy to use, support a wide range of use cases, and have been adopted by many developers. This means that they're well-maintained, well-documented, and have good support networks. We'll also cover a couple of other cron alternatives for windows and the cloud.
Top 6 cron alternatives
The six cron alternatives we'll discuss in this article are Airplane schedules, anacron, bcron, cronie, fcron, and systemd. Before we go into each of these scheduling tools in detail, here's a quick summary of what they each do:
|Airplane||Airplane is a great cron alternative if you're looking for an enterprise-grade tool with permissions, audit logs, notifications, and an easy-to-use UI. Airplane comes with a free pricing tier.|
|anacron||Anacron is best for scheduling events that are scheduled at specific intervals. It executes its job in days and doesn’t require a computer process to run continually so it can run without your machine being on 24/7.|
|bcron||Bcron is best for providing full-suite software to manage task scheduling. Bcron achieves this by modularizing component functions into disparate programs with strict communication control between them.|
|cronie||Cronie is best for recurring specified programs at a scheduled time. Using the anacron package, it also performs synchronous and asynchronous scheduled jobs.|
|fcron||Fcron is best for running tasks that need to run every few hours or minutes.|
|Systemd is a scheduling service manager. It’s used by major Linux distributions because of its new init system. It uses special units called service and timers to achieve this.|
1. Airplane Schedules
The first cron alternative we'll discuss is Airplane. Airplane is a developer platform for building powerful internal tools. Using Airplane you can transform scripts, queries, and APIs into schedules, UIs, and workflows in a matter of minutes.
Airplane offers a number of enterprise-grade features that are not offered by cron or many of the alternatives in this article. Airplane schedules are maintenance-free and serverless. You can get notified of run failures and see all of your active schedules and historical runs in one place. Airplane also provides superior functionality out of the box such as permissions, audit logs, notifications, and approval flows, so all you have to focus on is writing the business logic for your internal operations.
Since Airplane schedules are tightly integrated with the rest of the Airplane ecosystem, you get full visibility into past, present, and running jobs and can leverage built-in notifications for run failures, role-based access controls, and an easy-to-use UI for managing jobs centrally.
If you'd like to try Airplane out, you can sign up for a free account using the 'Sign up' button on the top right. You can also check out the Airplane blog for more cron-related content such as creating Golang cron jobs, how to run cron in containers, how to edit your crontab, and how to start, stop, and restart cron jobs.
Anacron is a periodic command scheduler that executes commands at intervals specified in days using boot scripts or cron jobs. One major difference between cron and anacron is that cron assumes the system is running continuously while anacron does not.
Unlike cron, anacron executes its job in days and doesn’t require a computer process to run continually. It can’t schedule commands that have intervals of less than a day. This makes it a good option for users who want to schedule jobs that run for days, weeks, and months on systems that are not always operating for 24 hours, such as for log rotations and database management. The programs can be scheduled as anacron jobs with periods of one day, seven days, and thirty days. Users who use laptop devices only and open their machines for a few hours each day will also find anacron useful. You can read more on cron versus anacron in this blog post: Cron versus anacron - understanding the differences.
To create a timer using anacron, use the following command syntax:
anacron -t [timername] -d [time interval] [command]
For example, to create a timer named mytimer that runs every hour, you would use the following command:
anacron -t mytimer -d 1h [command]
In the command above,
-t specifies the name of the timer,
-d specifies the time interval, and
[command] is the command that you want to run on the specified time interval.
In this example, the timer named
mytimer will run every hour and execute the specified
[command]. You can also specify a different time interval, such as every day, week, or month, by using the appropriate time interval argument in the
-d option. For example, to run the timer every day, you would use
-d 1d instead of
Bcron, also known as Better cron or Busy cron, is a simple yet secure alternative to the common cron design. Its purpose is to provide full-suite software to manage task scheduling. It achieves this by modularizing component functions into disparate programs with strict communication controls between them. This makes it more modular and secure compared to the conventional Vixie-cron system.
Bcron requires a three-step installation process that’s easy to follow. To configure bcron, you need to create a system user that will own all the crontab files. The operation allowed includes accepting crontabs from other users, updating crontabs of the system, and sampling the executable scripts.
To create a timer with cron, the basic syntax is
bcron <timing> <command>, where
<timing> specifies the time interval and
<command> is the command to be executed at each interval.
For example, to create a timer that runs a command every minute, you could use the following:
bcron @minute <command>
To create a timer that runs a command every hour, the command would be the following:
bcron @hourly <command>
You can also specify more specific time intervals, such as every 10 minutes or every 30 seconds, by using the following syntax:
The above syntax uses the cron syntax for specifying time intervals. The first five values represent the minutes, hours, day of the month, month, and day of the week, respectively. The asterisk (*) represents a wildcard, so in the above examples, the command will be executed every 10 minutes or every 30 seconds, respectively.
You can also specify multiple commands to be executed at each interval by separating them with a semicolon (;). For example:
bcron @hourly <command1>; <command2>; <command3>
This will execute all three commands at each hourly interval.
Cronie is based on the original Vixie-cron and contains the standard UNIX daemon crond that executes specified programs at a scheduled time. Cronie, unlike the cron and anacron, is a much smaller utility scheduler that can provide the full cron experience. To achieve the power of these cron alternatives, it packages anacron, which makes it possible to perform synchronous and asynchronous scheduling jobs right out of the box.
Getting started with cronie is a straightforward process, and you can easily install it by getting the program’s source code from GitHub. Once done, unpack the archive by executing tar in the terminal. From there, you can effortlessly compile cronie’s source code. You can use cronie to manage cron jobs on your machine. Using crontab, a command for executing recurring tasks (daily, hourly, or weekly) creates a crontab file containing the commands and files that the cron daemon can execute.
Please see below for the cronie command syntax.
To schedule a task to run at a specific time, use the following format:
[minute] [hour] [day of the month] [month] [day of the week] [command]
For example, to run a task at 10:00 AM on the 1st of every month, the command would be:
0 10 1 * * [command]
To schedule a task to run at a specific time interval, use the following format:
[minute]/[interval] [hour]/[interval] [day of the month]/[interval] [month]/[interval] [day of the week]/[interval] [command]
For example, to run a task every hour, the command would be
0 */1 * * * [command].
To schedule a task to run multiple times at specific times, use the following format:
For example, to run a task at 10:00 AM and 2:00 PM on the 1st of every month, the command would be
0 10 1 * * [command] 0 14 1 * * [command].
Note that the cronie command syntax uses asterisks (*) as wildcards, which means they can be used to represent any value in the time fields. For example, using an asterisk in the hour field would run the task at the specified minute at every hour.
Fcron is a great cron alternative because it combines the benefits of both cron and anacron. It doesn't require your computer to be running to work and can also run jobs on a daily, hourly, or minute-by-minute basis. Similar to the cron alternatives we’ve covered, fcron is a periodical command scheduler. It does, however, provide additional benefits. Fcron doesn’t run on assumptions about whether the system is frequently or consistently operating, making it easy for a user to execute tasks at specific times to accomplish a certain job. Fcron allows users to use its standard mode, where you can execute a given command at a specific frequency, date, and hour.
The other option is to tell fcron to run a command depending on system uptime. An example is “run the task save <folder> every 4h30 of system uptime.” System uptime is how long a system has been working and is in a stable and available condition. Similarly, you can schedule a task between intervals — for instance, between 4 AM and 6 AM.
Fcron also has several useful options that can be applied to the previous declaration commands that differ from cron. These options include:
- Running jobs sequentially (not parallelly)
- Informing the user that the schedule has not run and the reason
- Setting a maximum system load average value under which the job should run
Fcron is mostly run by scripts, unlike other cron alternatives, which use cron jobs. With scripts, you can execute several task instances simultaneously and exit when all the waiting jobs are completed.
To create a timer with fcron, you can use the following syntax:
fcron -a [user] [minute] [hour] [day of the month] [month] [day of the week] [command]
For example, let's create a timer for a user named Josh to run a command at 12:00 PM every day:
fcron -a john 0 12 * * * [command]
To edit an existing timer for a user, the syntax is
fcron -e [user] [command].
If we were to change the time for John, the syntax would be
fcron -e john [command].
Then, to delete a timer for a user, the command would be the following:
fcron -d john 0 12 * * * [command]
Note that the asterisks in the command syntax indicate that the timer should run every minute, hour, day, month, and day of the week. They can be updated with specific values if desired.
The final cron alternative we'll discuss is systemd. Systemd is a system and service manager for Linux that can be used for scheduling tasks. It’s an init system, making it a suitable out-of-the-box option to replace cron on most Linux machines. It’s been adopted by major Linux distributions, such as Debian and RedHat, among others. You can check out this blog post for more information on systemd timers and how to schedule tasks with systemd.
One thing to note is that cron and systemd have distinct differences in their scheduling and usage capabilities.
Systemd uses two distinct unit types: timers and services. Systemd timers enable you to manage dependencies separate from your imperative code. For instance, you can write small unit files in two files,
Additionally, systemd's calendar syntax is more intuitive and less error-prone than cron schedules. With the built-in tool to help you analyze when your next event will fire, systemd’s 'analyze calendar' (
systemd-analyze calendar *:*:0/<seconds>) gives a clear output for your scheduled jobs/events.
To create a timer with systemd, you can use the
systemd-run command. The syntax for this command is
systemd-run [OPTIONS...] COMMAND [ARGUMENTS...], where
COMMAND is the command you want to run on a timer, and
ARGUMENTS are any additional arguments you want to pass to that command.
For example, to create a timer that runs the foo command every hour, you can use the following command:
systemd-run --on-calendar=hourly foo
This will create a timer that runs the foo command at the start of every hour. You can use the
--on-calendar option to specify the schedule for the timer, using the standard systemd time and date format.
There are many other options you can use with
systemd-run to customize your timer, such as
--unit to specify the name for the timer unit,
--user to run the timer as a specific user, and
--property to set properties for the timer unit.
Other cron alternatives
While we discussed some of the most popular cron alternatives used by developers, there are other options that we didn't spend time on since they're less supported and lack documentation. Here are a few:
- Jobber — A cron replacement that offers job scheduling with more advanced error handling and reporting.
- mcron — A Linux task scheduling program that aims to reconstruct scheduling with cron jobs from the ground up.
- hcron — A command scheduler that makes it effortless to scale from a few events to thousands.
Cron alternatives for windows
One cron alternative for Windows is Task Scheduler. Task Scheduler is a native tool that enables you to perform flexible periodic tasks on your system automatically. Using set metrics known as triggers, Task Scheduler monitors your routines and executes them once the triggers are met.
Compared to cron, Task Scheduler offers many additional triggers you can configure to execute a scheduled task. These triggers can be things like:
- When a terminal session changes state
- When a user logs on
- When the computer is booted or a task is registered
Task Scheduler comes in two versions: Task Scheduler 1.0 and Task Scheduler 2.0. Each has different executable steps, as shown here.
Cron alternatives for cloud
Job scheduling is critical to ensuring that cloud resource performance, efficiency, and utilization are controlled.
Popular cloud platforms allow access to cron and the other cron alternatives discussed above to handle scheduling processes. They also typically have built-in functionality for scheduling tasks. We'll walk through a few of these in the next section.
Azure Functions make it possible to schedule and execute tasks using the timer triggers for repetitive functions. They’re easy to configure, as the binding properties in the
Different components/properties of Azure Functions’ timer triggers include:
type: This must be
direction: This is automatically configured when a trigger is created.
- name: A name for the timer object.
schedule: This property uses the cron expressions or timespan (for service plan) in the timer trigger. You can define when the function is to run.
Other properties are
useMonitor, which can be set to
false. If the
runOnStartup is true, the function should be invoked upon start. For
useMonitor, the schedule should be monitored.
Amazon ECS scheduled tasks
Amazon’s scheduled tasks use Amazon EventBridge rules to execute tasks on schedule by Amazon ECS support. Users can specify the intervals to run various tasks at selected times, including minutes, hours, or days. Amazon ECS also offers cron expressions for scheduling complicated situations and AWS-managed events.
GCP Cloud Scheduler
Cloud Scheduler is an enterprise-level Google Cloud Platform (GCP) scheduling tool that's typically used to manage and automate infrastructure processes. It enables you to schedule tasks, including batch processes and big data jobs, and manage automatic failure retries without manual intervention.
GCP’s Cloud Scheduler also gives you great visibility into your operations using a unified UI and CLI tool, making it easy to manage and view all your schedules in one place.
Get started with Airplane for free
As discussed in this article, there are a number of cron alternatives and scheduling platforms out there. If you're looking for a free cron alternative, systemd, anacron, cronie, fcron, bcron, and Airplane schedules are all great options.
Airplane in particular supports a massive feature set for scheduling tasks, but also, for running other non-scheduled operations and comes with a free pricing tier.
While this article focused primarily on scheduled operations, you can use Airplane for a lot more than just scheduled jobs. Tasks are the building blocks of Airplane and can be used for anything from single-step operations (restart a microservice, hit an API endpoint) to elaborate multi-step functions (customer onboarding workflow, admin panel for customer support).
Airplane also makes it incredibly easy to build custom UIs, called Views, that you can share with your team safely. Views comes with access to a rich component library, an extensive template library to help get started quickly, and first-class security.