1) Cron is very simply a Linux module that allows you to run commands at predetermined times or intervals. In Windows, it’s called Scheduled Tasks. The name Cron is in fact derived from the same word from which we get the word chronology, which means order of time.
For a developer we write code to run that particular code at a specific time using this cronjobs or Scheduled Tasks.

2) To set the cronjob :

In the cpanel of your web hosting server in that separate link called crontab,
in that we have to set the times and dates,

a)

1
echo $_SERVER['DOCUMENT_ROOT'];

run this in php file we will get server document path ,

b) In that we have the form like minutes, hours, day, month, week, if have to set values to particular time and date otherwise input as * then it treated as every minute, then in the command section we should place the

[ Minute – Hour – Day – Month – Weekday ] [PATH OF PHP] [ARGUMENTS] [PATH OF PHP SCRIPT]

In Some servers :
Example: /usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php

In some server we place like
Example :

1
php -q /home/tom/public_html/cron/maintenance.php

In the file maintenance.php we will write the code which one have to execute in the Corn job functionality.



1 Comment

Website uptime monitoring using php script - Anil Labs · July 14, 2012 at 4:35 am

[…] the cron job with every 5 Minutes and set the attached […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *