Forum Moderators: phranque
I have 3 files which I want run automatically at certain times.
Lets say for instance they are all in the same directory, they are called one.php, two.php and three.php.
The first one I want to run every hour of every day.
The second and third files I want to run at midnight of every day.
Should I use the following? Is it right?
* 0 * * * www.domain.com/dir/one.php
00 00 * * * www.domain.com/dir/two.php
00 00 * * * www.domain.com/dir/three.php
Thanks
TD
1. Minute of the hour (0-59)
2. Hour of the day (0-23)
3. Day of the month (1-31)
4. Month of the year (1-12)
5. Day of the week (Sunday = 0)(0-6)
Cron does not act as a http user agent. You'll have to specify the filesystem path to your script you want to run.
When running php scripts from the command line, you need to invoke the cli php interpreter. Try this (comment lines preceded by #):
# every hour, every day
0 * * * * php /full/path/to/dir/one.php
# midnight, every day
0 0 * * * php /full/path/to/dir/two.php
0 0 * * * php /full/path/to/dir/three.php
There are some other options and things to consider, so I suggest you check out the cron manual and a thorough tutorial.