For those who are familiar with the Unix system, you will also be familiar with the cron application that allows you to schedule and automate tasks to run on their own. We even have tutorials that show you how to get started with cron and crontabs. However, cron is not perfect, as it requires your system to be running 24 hours a day. If you have a habit of turning off your computer at night, and a cron job is scheduled in the sleeping hours, the task won’t be executed. Luckily, there are several cron alternatives that can do a better job than cron. Let’s check them out.
Anacron is a periodic command scheduler just like cron. The only difference is that it does not need your computer to be always running. You can schedule your task to run at any time. When your computer is off, the task will be executed the next time you turn the computer on.
To get started, simply install
anacron in your system. It is available in most package managers. Use the following command to install in Ubuntu:
Anacron works similar to cron. You can add your job to the
The syntax to add a job is
For example, to run a backup script everyday, you can add the following command:
The disadvantage of anacron is that it only deals with tasks on a daily, weekly or monthly schedule. You can’t use it for a hourly or minutes schedule.
Fcron is the best of both cron and anacron. It doesn’t require your computer to be running 24×7, and it can work with tasks on an hourly or minute basis.
The only way to install Fcron is to download the source file and compile it yourself.
1. Download the source file here.
2. Extract the archive. Open a terminal and change the filepath to the extracted archive folder.
3. Run the following commands:
It will ask you a few questions during the installation and you can safely answer “y” (yes) for all of them.
To start creating a fcron job, simply type
fcron -e in the terminal.
The syntax for fcron is similar to cron:
and it comes with more options than cron, such as setting up a task to run between a time range.
For those who prefer a GUI, you can check out fcronq
Hcron is relatively unknown, but that does not make it less useful. In fact, it comes with several features that make it unique. For example, you can easily label and organize your cron type jobs, manage a network of computers and your users’ crontab files, beck up easily, and version control your cron type jobs. The only drawback is that it has not been updated since 2010.
Hcron stores each event as a plain text file. To get started, simply create a text file with the command:
In the text editor that opens, you can fill in the details of the event.
There are many more things that you can do with hcron and it is advisable to download the user guide to have a better understanding of how it works.
Jobber is a task scheduler written in GO and is a more powerful tool than cron. It features job execution history with status, controlling whether and when a job is run again after it fails and getting notified on each failed run or only about jobs that were disabled due to repeated failures.
To install Jobber, you have to make sure that GO is installed in your system. Next, type the commands:
After the installation, start Jobber with the command:
To create jobs, create a file named “.jobber” in your home directory and add the job in the following format:
As you can see from the format, it allows you to define the actions to take when it has errors (“Stop”, “Backoff” or “Continue”) and whether it should notify you when it fails.
Once you have updated the job list, use
jobber reload to get Jobber to reload the new list.
At any time, you can use
jobber log to see a list of recent runs of any jobs.
Cron is widely available and easy to use, but when it doesn’t work as you require, you might be better off using a replacement app. The cron alternatives above are more powerful than cron and should fulfill your needs. If you know of other cron replacement apps that are not mentioned above, feel free to let us know in the comments below.
Image credit: CRONNNN