>
PHP script for cron
Welcome, Guest

by vineet on Tuesday, 09 December 2008
More Crontab Information


Components of cron

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

Setting up the cron

 

You will be in one of these situations.

ONE:This would be your first cron tab function.

SECOND:You already have cron tab file on your server running one or more cron functions for you.

In any of the above two situations you can further proceed by TWO METHODS.

METHOD ONE:Using Cron tab manager:

If you have a cron tab manager in your webpanel, it will be easy for you to set the cron tab function. You can click on the icon to open cron manager.

There will be some box like text area where you can enter the the php file path that you want to run the cron job.

Your cron manager may be different but basically it is easy to set up cron job with your cron manager. I highly recommend this unless you want to get to know about the Second Telnet Method.

 

METHOD TWO:Uploading 'cron.txt' file and checking using telnet:

 Cron Commands:

crontab filename
Install filename as your crontab file. On many systems, this command is executed simply as crontab filename (i.e., without the -a option).

crontab -e
Edit your crontab file, or create one if it doesn't already exist.

crontab -l
Display your crontab file.

crontab -r
Remove your crontab file.

crontab -v
Display the last time you edited your crontab file. (This option is only available on a few systems.)

 

How to do it?

    Basically FOUR steps:
  • Create cron.txt
  • Upload
  • Install the txt file as cron file with the command 'crontab cron.txt'
  • Check your cron file

1. Open your notepad on your computer and write cron job following the guidelines explained above under 'What are the components of cron?'. For example - If you write your cron job like this:

30 23 * * * /home/username/www/cgi-bin/members.cgi

After writing the above cron job PRESS return key so that a blank line will be there below the cron job line.

2. Always use absolute path for the command line. Turn off the 'Word Wrap' feature with the Notepad.

3. Save the file as 'cron.txt'. Upload it to your root directory ('/'). Or ask your webhost where to upload the cron files. Upload in ASCII mode.

 

Here is how positions 1-5 are layed out:

1 Minute 0-59
2 Hour 0-23 (0 = midnight)
3 Day 1-31
4 Month 1-12
5 Weekday 0-6 (0 = Sunday)

An asterisk (*) is used to indicate that every instance (i.e. every hour, every weekday, etc.) of the particular time period will be used.

If you wish to use more than one instance of a particular time periods, then seperate the times by a comma. If you wish for continuous execution, the start and stop items are separated by a dash. For example, if you wanted to run your command at :05 and :35 past the hour, every hour, Monday through Friday, then your time stamp would look like this:

5,35 * * * 1-5

The sixth position indicates which task will be run at the given time(s). For example, if you wanted to remove all of the files in you "temp" directory every morning at 4:45 AM, your command would look:

 


Topic Normal scheduling cron job parameters
by sushil on 12/09/2008 16:06

Hi,

setting cron job which will be executed in every 10 minutes...

*/10 * * * * <file to be executed with full path>

10 can be replaced with any time when u want to schedule job e.g 

setting cron job which will be executed in every 5 minutes...

*/5 * * * * <file to be executed with full path>

Now if you want a cron job to run every hour...

0 * * * * <file to be executed with full path>

 If you want something to run once every two hours...

* */2 * * * * <file to be executed with full path>



Blogger Image
My Blog Title

Product Engineering, software engineering company, Product Development, Product Migration, Product Re-engineering, Product Maintenance, Product Testing Commercial Application Development, Business Software development, commercial software for startups, Application Support and Maintenance, software testing Product Maintenance, Outsource product maintenance, product support and maintenance Product Migration, Product Re-engineering, product re-engineering services Product Research, Product Engineering, UI Prototyping Services Software Testing Services, Quality Assurance services, professional software testers, Load Testing, Functional Testing, Cross Platform, Browser Testing, Test Automation, Testing Tools, software quality analysis Functional Testing Services, software quality analysis, Software Testing Services, Application Testing Services, Functional Testing Types Automated Testing, Automated Testing Services, automation testing, test script development, Automation Test Tools, outsource automation testing Load Testing, Performance Testing Services, Load Testing Tools Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Benefits of IT Outsourcing, Offshore Software Development companies, offshore software development firms Outsource planning, IT outsourcing, IT development services, offshore IT companies, offshore software development Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering