| Home | Free Articles for Your Site | Submit an Article | Advertise | Link to Us | Search | Contact Us |
This site is an archive of old articles

    SEARCH ARTICLES


vertical line

Article Surfing Archive


CRON ' Automatically Run Jobs on Your Website - Articles Surfing


Sometimes you have repetitive jobs to run on your website. Most web servers have a function that will schedule and run jobs automatically for you. Just set up the schedule and let it run on autopilot.

CRON is a function in Unix and Linux operating systems which allows you to schedule a job and the job will run at the date and time scheduled until you delete the CRON statement.

Initially, you may consider this to be too technical for you, but not so if you will carefully read this article. It is a function of which you should be aware. Even if you do not need it now, remember about CRON for the day you will need it.

Apache server includes this function and it is easy to use with the graphical interface.

The format for CRON is 'CRON * * * * * Command to execute"

Each asterisk represents a field in the command and can contain the following values. If you do not want to specify a value for that particular field, leave the asterisk in that position in the CRON statement line. Each of the five fields is separated by white space.

Here are the values that each field (left to right) can have other than the asterisk:

Field -------- Value ----- Description
minute ----- 00-59 ------exact minute the cron executes
hour -------- 00-23 ------ hour of the day the cron executes(0 =midnight)
day --------- 01-31 ------ day of the month the cron executes
month ------ 01-12 ------ month of the year the cron executes
weekday --- 00-06 ----- ay of the week the cron executes(Sunday = 0, Monday = 1, Tuesday = 2, etc)
command ---varies ------ sequence of commands to execute

What prompted the need for the CRON on our site was our use of the software package that required that we copy the ClickBank master file into a file on the Boomer-eZine website periodically so our copy is kept current with the ClickBank master.

Since we get busy and forget to do this weekly, a method to have our web host perform this automatically was the answer.

The CRON function is very flexible and can be set to run on almost any time frequency you can imagine.

If you specify a minute in the first field and an hour (24 hour clock) in the second field and leave all the other fields as asterisks, the specified program will run on that hour and minute every day. If you want the program to run twice a day at 10 and 11 AM, you can write the CRON as:

CRON 0 10,11 * * * Command to execute

With the proper combinations, you can set up a job to run automatically on almost any schedule that you can imagine.

Let's try a few. Write a CRON to execute on every Sunday at midnight.

If you got '0 0 * * 0 Command to execute", then you are right. The zero in the first position is on the hour. The zero in the second position is midnight. The zero in the fifth position (day of the week) is Sunday. This is what we used for our CRON settings for the CD AD Box update.

Set up a CRON to run once per year on the last day of the year at midnight.

CRON 0 0 31 12 * Command to execute

If you have a graphical interface on your web server, it is easy to enter the CRON information

Sometimes the CRON function is difficult to find in your control panel. If you have difficulty finding it, send an email to the support group for your web host and ask if this is available and if so, where is it located.

As I said earlier, you may not need this right now, but remember it for when it will come in handy for you. It can greatly simplify the work of managing your website.

Copyright 2006 John Howe, Inc.

Submitted by:

John V. W. Howe

John V. W. Howe is an entrepreneur, author, inventor, patent holder, husband, father, and grandfather. He has worked with computers for over 44 years. He is an expert in website creation and web hosting. He has published over 60 articles on the Internet covering diverse topics. His website http://www.the-best-web-host.com helps people analyze their needs and match those needs to the best web host. He also publishes http://www.boomer-ezine.com an ezine for Internet entrepreneurs.


        RELATED SITES



https://articlesurfing.org/web_development/cron_automatically_run_jobs_on_your_website.html

Copyright © 1995 - 2024 Photius Coutsoukis (All Rights Reserved).

ARTICLE CATEGORIES

Aging
Arts and Crafts
Auto and Trucks
Automotive
Business
Business and Finance
Cancer Survival
Career
Classifieds
Computers and Internet
Computers and Technology
Cooking
Culture
Education
Education #2
Entertainment
Etiquette
Family
Finances
Food and Drink
Food and Drink B
Gadgets and Gizmos
Gardening
Health
Hobbies
Home Improvement
Home Management
Humor
Internet
Jobs
Kids and Teens
Learning Languages
Leadership
Legal
Legal B
Marketing
Marketing B
Medical Business
Medicines and Remedies
Music and Movies
Online Business
Opinions
Parenting
Parenting B
Pets
Pets and Animals
Poetry
Politics
Politics and Government
Real Estate
Recreation
Recreation and Sports
Science
Self Help
Self Improvement
Short Stories
Site Promotion
Society
Sports
Travel and Leisure
Travel Part B
Web Development
Wellness, Fitness and Diet
World Affairs
Writing
Writing B