LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   is my crontab crazy ?! (https://www.linuxquestions.org/questions/linux-software-2/is-my-crontab-crazy-872385/)

hen770 04-01-2011 08:58 AM

is my crontab crazy ?!
 
see what i mean by the title.
when i put the following code in my cronjob via the command cronjob -e (from my user), it get it and everything works great.
Code:

SHELL=/bin/bash
MAILTO=hanan
16 15 * * * /bin/mount /dev/sdb2 && /usr/bin/rsync -r -t -v --progress --delete --size-only /home/hanan/Programs /home/hanan/Backup/Programs && /bin/umount /dev/sdb2

the thing to point your eye on is the time.
and when i am trying to put another time in it like that:
Code:

SHELL=/bin/bash
MAILTO=hanan
16 57 * * * /bin/mount /dev/sdb2 && /usr/bin/rsync -r -t -v --progress --delete --size-only /home/hanan/Programs /home/hanan/Backup/Programs && /bin/umount /dev/sdb2

it won't let me to save that, and give me the following error:
Code:

crontab: installing new crontab
"/tmp/crontab.cxyC4J/crontab":2: bad hour
errors in crontab file, can't install.
Do you want to retry the same edit? (y/n)

what do you think ha ? :scratch:

Thanks. :p

szboardstretcher 04-01-2011 09:00 AM

Because there are only 24 hours in a day. 57 is out of range.

AlucardZero 04-01-2011 09:00 AM

No, crontab is correct. Hour 57 doesn't exist. The format is

Code:

# minute hour  day-of-month month day-of-week  command
If you want the job to fire at 4:57 PM, you need: 57 16 * * * /bin/mount/etc

hen770 04-01-2011 09:27 AM

well, thank you guys, i have totally forgot about that, the first one is the minutes .

Thanks.


All times are GMT -5. The time now is 09:53 PM.