
There are other GUI apps built to easily edit cron, such as Gnome-Schedule. However, if you don’t want to install any new apps Corntab is a great web based solution, especially if you are setting up a cron job on a computer that doesn’t have Gnome-Schedule, or isn’t compatible with it.
The uses for cron are pretty obvious, anything from scheduling backups to running custom scripts at specific times, to opening programs on a schedule, cron is the way to get it done.
Let’s start with scheduling a task that simply creates a timestamp every minute to a log file, first using the shell/command line. Then we’ll run through the same steps using Corntab, so you can see how easy it is to use. Creating a timestamp or any output to a log file is a great way to test that your settings in cron are working, and of course to monitor your schedule going forward.
Open a terminal. Before we start, it is best to know where to go for information. The manual for crontab can be found by typing:
man crontab
The syntax for cron is as follow:
crontab [ -u user ] file
crontab [ -u user ] [ -i ] { -e | -l | -r } [-s]
-l
option causes the current crontab to be displayed on standard output.-r
option causes the current crontab to be removed.-e
option is used to edit the current crontab using an editor specified by the VISUAL or EDITOR environment variables.-u
option specifies the name of the user whose crontab is to be tweaked. If this option is not given, crontab will use the current user who is executing the command.-s
option appends the current SELinux security context string as an MLS_LEVEL setting to the crontab file before editing / replacement occurs (see the documentation of MLS_LEVEL in crontab. This is not used in all variations of Linux/cron).
su
command, or the sudo
command which should work in most Linux variations (Debian, Ubuntu, Fedora).To edit your crontab type:
crontab -e
sudo crontab -e
Some ground rules for cron
- A field may be an asterisk (*), which always stands for “first-last”.
- m -minute (0-59)
- h -hour (0-23)
- dom -day of the month (1-31)
- mon -month of the year (1-12)
- dow -day of the week (0-6 with 0=Sunday)
- command -application, script, etc
Advanced Short codes:
string meaningComma-separated values can be used to run more than one instance of a particular command within a time period.
—— ——-
@reboot Run once, at startup.
@yearly Run once a year, “0 0 1 1 *”.
@annually (same as @yearly)
@monthly Run once a month, “0 0 1 * *”.
@weekly Run once a week, “0 0 * * 0″.
@daily Run once a day, “0 0 * * *”.
@midnight (same as @daily)
@hourly Run once an hour, “0 * * * *”
Dash-separated values can be used to run a command continuously.
Let’s set up our cronjob.
If you are first entering crontab you will probably be given a choice of editor to use. Feel free to choose any, but I normally stick with nano since it is simple, clean, and gets the job done.
To accomplish our original task, simply type:
* * * * * echo "The current minute is: $(date)" >> /tmp/minute.log
Here’s the automatic output for 6 minutes:

Let’s get fancy, how about printing the date every 2 minutes…
*/2 * * * * echo “The current minute is: $(date)” >> /tmp/minute.log
How about printing the date at 5:30am every Monday and Friday:
30 5 * * 1,5 echo "The current minute is: $(date)" >> /tmp/minute.log
Playing with Corntab
Now let’s try out CornTab, the web based cron editor that will take care of the syntax while we just click the options.Here’s a step by step to create a crontab that will print the current date/time every two minutes, only in January, February, March, and April, on Thursday’s and Friday’s.
First, click “every n minutes” and move the slider to 2 minutes.

Next, click to expand month, click to select “each selected month” and select Jan, Feb, Mar, Apr.

Next, click to expand Day of Week, select “each selected day of the week” and select Thu and Fri.

Finally, click to expand Command and type in the code/script. Then you can copy the full cron code from Corntab and paste it into your crontab by using the steps at the beginning of this article.


......................................