Cron is the Linux equivalent of Window's Task Scheduler.
Jobs are executed from /etc/crontab
1. Create a PHP script file.
2. Edit the crontab
# crontab –e
This is the file syntax:
minutes hours day_of_month month day_of_week command
where:
minutes: 0-59
hours: 0-23
day_of_month: 1-31
month: 1-12
weekday: 0-6
command: Any shell command or web document
Wildcard: * (Allow any value)
I will use wget because PHP files need to be parsed by Apache, we need to execute it via wget command using the URL to the page. To check if your box has wget:
# wget --help
To run the script every Wednesday morning at 9:30 AM, the cronjob file will contain the following in single line:
30 9 * * 3 wget http://www.domain.com/file.php
Save the file and add to crontab
# crontab samplecronjob
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment