Username: Save?
Password:
Home Forum Links Search Login Register*
    News: Welcome to the TechnoWorldInc! Community!
Recent Updates
[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[February 14, 2024, 02:00:39 PM]
Subscriptions
Get Latest Tech Updates For Free!
Resources
   Travelikers
   Funistan
   PrettyGalz
   Techlap
   FreeThemes
   Videsta
   Glamistan
   BachatMela
   GlamGalz
   Techzug
   Vidsage
   Funzug
   WorldHostInc
   Funfani
   FilmyMama
   Uploaded.Tech
   MegaPixelShop
   Netens
   Funotic
   FreeJobsInc
   FilesPark
Participate in the fastest growing Technical Encyclopedia! This website is 100% Free. Please register or login using the login box above if you have already registered. You will need to be logged in to reply, make new topics and to access all the areas. Registration is free! Click Here To Register.
+ Techno World Inc - The Best Technical Encyclopedia Online! » Forum » THE TECHNO CLUB [ TECHNOWORLDINC.COM ] » Computer / Technical Issues » Web Design / Graphics Design/ Animation » Website Development
 CRON – Automatically Run Jobs on Your Website
Pages: [1]   Go Down
  Print  
Author Topic: CRON – Automatically Run Jobs on Your Website  (Read 483 times)
Shawn Tracer
TWI Hero
**********


Karma: 2
Offline Offline

Posts: 16072


View Profile
CRON – Automatically Run Jobs on Your Website
« Posted: February 20, 2008, 05:16:50 PM »


CRON – Automatically Run Jobs on Your Website
 by: John V. W. Howe


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.

About The Author
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.

Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Copyright © 2006-2023 TechnoWorldInc.com. All Rights Reserved. Privacy Policy | Disclaimer
Page created in 0.091 seconds with 25 queries.