Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a crontab that performs a massive operation that needs to run once every five hours

#min     hour     mday     month     wday    user     command


*         */5     *         *        *      root        

/Users/pdadmin/Desktop/files.sh 1>> /Users/pdadmin/Desktop/files.log 2>&1

However, when I enter in the following, it runs once every minute! What am I doing wrong here?

share|improve this question
1  
You can become more familiar with the crontab timing parameters at www.CronBuddy.com. It lets you play about with different values and see a list of the job run times. –  mlbx Feb 6 '13 at 6:30
add comment

migrated from stackoverflow.com Feb 4 '13 at 4:03

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 6 down vote accepted

Your crontab entry specifies that the job should run on every minute (* in the first column) of every 5th hour (*/5 in the second column). I assume you meant to run it on some specific minute of every 5th hour, i.e. once only during each eligible hour. In that case you would put, say, 0 or 42 (or really anything between 0 and 59) in the first column.

Also, the number of hours in a day is not divisible by 5, so even such an entry won't run exactly every 5 hours. It will run at hours 0, 5, 10, 15, and 20. After 20:xx it will run again at 0:xx, which is only 4 hours. Maybe this matters to you or maybe it doesn't.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.