After hours of searching on cron sites, these are the most helpful tips.
My own solution for running the cron for a moodle install in powweb in Sept. 2005 was not what I thought. Oh and I put the cron in an etc file outside the public site which was chmod to 700 (though I hear that 644 will do just as well.
I had anticipated 6 items for the moodle cron on powweb
- The time identifier, to run every five miutes each item represents: Minute in the hour | Hour of the day | Day of the month | month in the year | day of the week 0=Sunday
* /5 * * * *
- The shebang, which is optional. Depending on the host config it may be necessary to identify the path to the compilation of php so that cron understands what to do. From what I can gather, if php is run via cgi then the shebang is unnecessary (but I wouldn't stake my life on it!).
- An email suppression. I read 2 version of this. one says put a -q here but this actually suppresses the HTTP header output. So long as the script doesn't use echo or print this will prevent the email.
- The location of the php script that is to be 'run' by the crontab. Cron has many more things it can do other than run a php script! Always run the path from the root folder. If for any reason it can't run from root, the file should be chmod 755 in order for it to have permission to be run outside it's environment.
- If you want to put the log of this script execution into a log then add the following
- If you want to put any errors into a log then add
- Another alternative to the suppress email is to include this code at the end, but I found no explanation to its cryptic content
So this is what I thought my crontab would be:
So I used the powweb interface and it produced the following: