Crontab explanation

motioneye
motioneye used Ask the Experts™
on
Hi,
anyone mind to explain following crontab schedule ?


25 07-19,21,23 * * 0,6 /opt/sybase/home/edt_local/bin/backup_sybase Instance_Test -trans
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016
Commented:
25 - runs on this minute
07-19,21,23 - runs from hours 07 - 19 and 21 and 23
* - runs every day
* - runs every month
0,6 - runs on weekdays 0=sunday and 6=saturday
/opt/.. - the command to run
Most Valuable Expert 2013
Top Expert 2013
Commented:
The program will run 25 minutes past every hour from 7:00 AM to 7:00 PM, as well as 25 minutes past 9:00 PM and 11:00 PM, every Saturday and Sunday, regardless of month and date.

wmp
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Commented:
@wmp - 8 seconds difference, wow :D
Most Valuable Expert 2013
Top Expert 2013

Commented:
@gerwin - you're fast!

Author

Commented:
Hi,
Is that means:

25 - runs on this minute
The cronjob will run every 25 minutes from 07-19,21,23
* - runs every day
* - runs every month
and every 25 minutes on Saturday and Sunday ?, which means the cronjob will run twice every hour  at min 25 and min 50 ?
Most Valuable Expert 2013
Top Expert 2013
Commented:
No, only once every specified hour, at 25 minutes past the full hour:

7:25, 8:25, 9:25, 10:25, 11:25, 12:25, 13:25, 14:25, 15:25, 16:26, 17:25, 18:25, 19:25, 21:25, 23:25

on Saturdays and Sundays,
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Commented:
In case you want to 'debug', you could replace your cron command with something like this:

echo `date` >> /var/tmp/cronlog.txt

Each time cron triggers your 'job', you'll get a timestamp in your log file.
Most Valuable Expert 2013
Top Expert 2013
Commented:
Just a hint:

date >> /var/tmp/cronlog.txt

is sufficient. No need for overengineering.
Commented:
/usr/bin/date >> /var/tmp/cronlog.txt

is more complete - with crontab jobs it is better to not rely on the path ;-).
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Commented:
@mdeweerd - you are correct :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial