What is crontab?
cron is a Unix utility or program, which allows users to run other programs at scheduled times. Crontab is a file which contains the schedule of cron entries to be run and at specified times. In order to run a cron job, you need to program it. Fortunately, most web servers are able to do this via their cpanel.
Cron job can be set via two methods -
1. Standard
2. Unix Style
In standard method there is an interface provided for time settings. User just need to set curl “path to file”.
Here we will look second unix style of setting cron, which requires simple command with some parameter for specifying time limit to run cron file.
Example :
* * * * * /usr/local/bin/php -q /home/username/public_html/testcron.php
In this example testcron.php is the file name on your server. You just need to change username here. * * * * * denotes this file will execute every single minute.
Following are some of the example of time settings.
* * * * * -> Execute every minute
0 * * * * -> Execute every Hour
0 0 * * * -> Execute every mid-night
0 0 0 * * -> Execute every Month
0 0 0 0 * -> Execute every Weekday
Here first * denotes – > 0-59 minutes
second * denotes -> 0-23 hours
third * denotes – > 1-31 days
fourth * denotes -> 1-12 months
fifth * denotes -> 0-6 day of week
That’s it. You just need to find out for cron job time with above conventions.

Leave a Reply