Cronjobs allow you to automate certain commands or scripts on your site. You can set a command or script to run at a specific time every day, week, etc. For example, you could set a cron job to delete temporary files every week to free up disk space.
Cronjob is a function which is called by server without any event perform by user. Generally to call any event you need to do any event like click, visit, etc. But cronjob does this automatically without any event call.
So how does this cronjob calls automatically?
To set a cronjob, you need to specify the time of the cronjob, at which time the cronjob function will call. So cronjob only depends on time of the server.
Now you might be wondering that, which timezone considered while cronjob fire?
Cronjob depends on server’s timezone.
So if you are calling the cronjob for different region rather than server’s location, you need to change the cronjob’s calling time according to your region.
How to set cronjob usnig cpanel?
In your Home page of the cpanel, find Cronjob, and go for it.
Here you have several parameters to set the cronjob, like below image.
Here using common settings, you can get idea about what set in each inputs to set perfect cronjob.
But never mind, if you haven’t this common setting option.
If you want to run cronjob every minute than use below code to set
* * * * * lynx -dump http://example.com/function
If you want to run cronjob once per day than use below code to set
0 0 * * * lynx -dump http://example.com/function
Thus cron will run on midnight 12 at every day.
If you want to run cronjob twice per day i.e. 4 and 8 than use below code to set
0 4,8 * * * lynx -dump http://example.com/function
So consider following syntax to set cronjob.
Minute Hour Day Month Weekday lynx -dump http://example.com/function
Note : Weekday’s values are : Sunday(0),Monday(1),…