Here are some typical environment variables as set
AM: ……………………………………………………………………………………….. * 8 * * * * dbadmin /usr/local/bin/db-backup.sh ……………………………………………………………………………………….. In this case, you’d find that the job would run at 8 AM, all right, as well as at 8:01, 8:02, 8:03, and so on, until 9:00 AM. If your job takes more than one minute to run, you’ll quickly bring your system to its knees. The correct way to specify 8 AM and only 8 AM would be to enter this: ……………………………………………………………………………………….. 0 8 * * * * dbadmin /usr/local/bin/db-backup.sh ……………………………………………………………………………………….. To specify ranges of time, such as running this program once an hour, every hour, between 8 AM and 6 PM, Monday through Friday, use something like this: ……………………………………………………………………………………….. 1 8-18 * * * 1-5 dbadmin /usr/local/bin/db-backup.sh ……………………………………………………………………………………….. To specify exact times, separate them with commas: ……………………………………………………………………………………….. 1 8,10,12,15,18 * * * 1-5 dbadmin /usr/local/bin/db-backup.sh ……………………………………………………………………………………….. Or, more interestingly, you can specify fractions of time, or steps. For example, to run a program every five minutes, enter the following: ……………………………………………………………………………………….. */5 * * * * * dbadmin /usr/local/bin/db-backup.sh ……………………………………………………………………………………….. You can also combine ranges with steps. For example, if you want your job to run every five minutes, but want it offset by one minute from the preceding job, you could use this: ……………………………………………………………………………………….. 1-56/5 * * * * * dbadmin /usr/local/bin/db-backup.sh ……………………………………………………………………………………….. You can control the day a job runs with two fields: the day of the month and the day of the week. If you specify both a day of the month and a day of the week, the job will run whenever either condition is met. For example, you might tell cron to “Run this job on the 1st and the 15th, plus every Monday” as follows: ……………………………………………………………………………………….. 55 13 * 1,15 * 1 dbadmin /usr/local/bin/db-backup.sh ……………………………………………………………………………………….. If you find that a job requires a nonstandard environment, set the environment on the command line just as you would in the shell. For example, if your db-backup.sh program requires a 190
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Unix Web Hosting services