What is cron on a Linux or Unix-like systems?

Posted on in Categories , last updated May 3, 2017

Can you explain what is Cron? Why do I need to cron service on a Linux, OS X, and Unix-like systems?

Cron is UNIX/Linux/BSD service or daemon to execute commands or scripts at given time and date. It is also known as the clock daemon that executes commands at specified dates and times according to instructions in a file.

Generally, crontab uses a daemon, crond, which runs constantly in the background and checks once a minute to see if any of the scheduled jobs need to be executed. If so, it executes them. These jobs are generally referred to as cron jobs.

Cron is controlled by a set of files called “crontabs”. There is the master file in /etc/crontab. Each users cronjob is stored in /var/spool/cron/username directory. To see master file type the following cat command:
$ cat /etc/crontab
Sample outputs:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

Editing Crontab or setting up your own job

Just type following command:
$ crontab -e
To list your own jobs type the following command:
$ crontab -l

How do I configure and install my own cron jobs?

See our tutorial on how to automatically run given commands or scripts at a specified time and date:

This entry is 1 of 14 in the Linux Cron Jobs Howto & Tutorial series. Keep reading the rest of the series:
  1. What is cron on a Linux or Unix-like systems?
  2. HowTo: Add Jobs To cron Under Linux or UNIX?
  3. Linux Verify crond Daemon And Cronjobs Are Running
  4. Linux Start Restart and Stop The Cron or Crond Service
  5. Linux: List / Display All Cron Jobs
  6. Linux / UNIX Crontab File Location
  7. Linux / UNIX: Change Crontab Email Settings ( MAILTO )
  8. Disable The Mail Alert By Crontab Command On a Linux or Unix-like Systems
  9. Linux: At What Time Cron Entries In cron.daily, cron.weekly, cron.monthly Run?
  10. Linux Execute Cron Job After System Reboot
  11. Linux / UNIX Setup and Run PHP Script As A Cron Job
  12. How to run crontab job every minute on a Linux or Unix-like system
  13. Run crontab (cron jobs) Every 10 Minutes
  14. Cron Job Script Execution on the Last Day of a Month

1 comment

  1. i need to know more about cron.. I’m doing a project with the help of it. In banking application, where to obtain quick updation among third party branches, where the cron is applied to get the quick updation.i request u to send me the info about cron.

Leave a Comment