At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What is a Cron Job?

A cron job is a scheduled task that automates repetitive actions on a computer system, ensuring vital functions like backups and updates occur without fail. It's like a digital timekeeper, executing commands at intervals you set. Imagine the possibilities of streamlining your tasks with such precision. Ready to unlock the potential of cron jobs in your workflow? Let's explore how.
Shannon Kietzman
Shannon Kietzman

A cron job is an automated program developed for Unix and Linux systems. It allows the user to execute several commands at a specific time on a precise date. A cron job is an important tool that can be used for anything from running scripts and re-indexing a web page to providing backup for a database. A cron job can also be used as a reminder for downloading email. The user only needs to set the program up once in order for it to continuously complete the job.

If a web e-zine owner has over 100 email subscribers reading his publication on the 25th of each month, for example, a cron job could assist in getting the information out to each reader at the same time and date each month. In addition, it can add new members to the web site and remove those who unsubscribe while maintaining the database.

Man holding computer
Man holding computer

A cron job is set up with cron tabs within a cron tab manager. Cron tabs are divided into six fields: minutes, hours, days, months, weekdays, and commands. The command field provides instructions to the computer. The minute field runs from 0-59 and gives the exact minute the command is to be executed. The hour is set between 0-23, with zero representing midnight.

The days of the week run from 0-7, with both 0 and 7 representing Sunday. Some older systems, including some Unix systems, use 0 through 6 as the days of the week, 0 being Sunday. White spaces or tabs must separate each field. Commas are used when adding a list, while asterisks are added where the user does not wish to specify a field. For the aforementioned web e-zine owner, for example, the cron job can be set up with an asterisk in place of the day of the week because the 25th day of the month will not always fall on the same weekday.

A cron job is written in a text file with a series of cron commands for the computer to adhere to. Preparing a cron job as a text file also makes it easier to edit the scripts later if needed. In addition, the cron job can be set up to either allow or deny certain users from tweaking the set cron tab. Once the text is created for the cron job, it is followed by a .txt extension, such as Cron.txt. Then, the job is uploaded and the text file's accompanying command would read as "crontab cron.txt" before it takes effect on the web page.

You might also Like

Discussion Comments


My cronjobs file has in 1st 5 lines:


= '4.0') {





if (system_value("cronjobs_ran_at")>time()-290){

And I got an installation information file written:

This is the cron job you or your programmer needs to create (all on one line - No carriage returns.)

* * * * * /PATH/TO/lynx --dump http://PUT_YOUR_DOMAIN_NAME_HERE/scripts/admin/cronjobs.php > /dev/null

(Replace "PUT_YOUR_DOMAIN_NAME_HERE" with *your* domain name

Now I don't know where to write this and I read your article I want my database or host to read the cron job file every minute ... please tell me where I have to write those lines and what the procedure is. Please tell me as I'm not a script expert.

Post your comments
Forgot password?
    • Man holding computer
      Man holding computer