From the powweb tutorials section.
Cron will allow for you to run a command at a specific time automatically. Whether you need it to run daily or weekly, you'll be able to accomplish this once the task is set up through Cron. Cron in essence is similar to a task scheduler, like the one built into the Windows Operating System.
To set up Cron properly, you will need to do the following:
- Create a file called crontab
- Place the commands in the file using the format below:
- Upload the file to the etc directory
- Note: This file must be uploaded in ASCII mode. If this is the first time for uploading this file, you'll need to wait until midnight PST. Subsequent changes will be effective after you update the file.
Only one command can be on a line, and follow this format:
- minute 00 - 59 hour 00 - 23
- day 1 - 31 month 1 - 12
- weekday 0 - 6 (0 = Sunday)
To specify multiple values for a field, separate the values with commas. For example
15,45 0,6,12,18 * * *
will run a command at 15- and 45- minutes after the hour at 12AM, 6AM, 12PM, and 6PM.
The command is the
/www/ui/user/your/script part of the cronjob.
Make sure the cronjob is being run from the base directory of the server, so you will need to specify the full path:
/www/ui/user/your/script not /your/script
Note: Make sure to change the path to reflect your directory. ui = username initial (the first letter)
Wildcard Usage:Asterisks (*) specify when commands are to be run in every instance of the value of the field. For instance, an asterisk in the Month field would mean that the command should be run every month.
Output from a script will not be sent anywhere, unless you specify a location for this information to go. This will enable you to see whether or not your command was successful. To enable this, add the following to the crontab, after your command:
>>/www/u/user/logs/script.log 2>>/www/u/user/logs/script.err
This will write all output to script.log, and send any error information to script.err.
Note: Make sure you change the path to reflect your directory.
For more information about cronjobs, please visit the following web site:
http://www.uwsg.iu.edu/usail/automation/cron.html
Contributed by ffejy
45 1 * * * (cd /www/u/user/pathtotwikibin; ./mailnotify -q)
This should run the mailnotify program at 1:45 every morning.
--
DaleBrayden - 11 Jul 2002