The following CRON script can be used to trigger an URL (example below is schedule to run every minute, for other schedule setting please refer to other CRON tutorial).
0 * * * * wget -q -O - http://www.example.com/notify.php >/tmp/cron 2>&1
In Linux, wget is used to download file from internet (or network). -q option means quiet, -O means output file. It is important to put the -O option so that your server won’t end up with annoying CRON output file.
To schedule your website to run a particular PHP file (to email or some other things):
- Go to your website control panel
- Go to Cron Job (it is the scheduler in Linux system)
- Usually you can choose GUI method or coding method to set the schedule
- You need to set the minutes, hours, dates, months and weekdays
- For the command to be run:
lynx -dump http://your.website.url/yourphpfile.php
lynx is the command to execute the PHP file
- Usually you can key in the email to be sent when the scheduler execute the commands