Operating System - Linux
1747997 Members
4431 Online
108756 Solutions
New Discussion юеВ

Re: Crontab Time Setting question

 
SOLVED
Go to solution
Jorge Cocomess
Super Advisor

Crontab Time Setting question

I can't seem to figure out the correct syntax for setting this cron job with specific time.

I would like to run this particular job at these time slots:

6:30
10:15
13:15
16:00
19:15

This is how I have it setup and working, but I can't figure out what to do with the one with 15 minutes job.

30 6,10,13,16,19 * * * /tmp/My_File

Please help.

Thank you in advance.

Jorge
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Crontab Time Setting question

Shalom

30 6 * * * /tmp/My_File
15 10 * * * /tmp/My_File
15 13 * * * /tmp/My_File
00 16 * * * /tmp/My_File
15 19 * * * /tmp/My_File

There is no way to do this with one line in cron. If there is a way to do it on one line with Linux, its not supported off platform and I would not do it because I want my cron schedules portable with HP-UX, AIX and Solaris.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
IT_2007
Honored Contributor

Re: Crontab Time Setting question

your settings performs for every hour with min. as 30, 6, 10, 13, 16 and 19.

crontab isn't user friendly. You may have to setup multiple cron jobs to run at specific times since these timings are not in sequence.

1 - min.
2 - hour
3 - weekday

if you want to setup cron job which runs every 15min, then do this

0, 15, 30, 45, 60 * * * /tmp/my_file >/dev/null

Ivan Ferreira
Honored Contributor

Re: Crontab Time Setting question

You need to create three jobs:

# At 16:00
0 16 * * * /tmp/My_File
# At 6:30
30 6 * * * /tmp/My_File
# At 10:15, 13:15, 19:15
15 10,1319 * * * /tmp/My_File
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
IT_2007
Honored Contributor
Solution

Re: Crontab Time Setting question

sorry. you have to setup 2 cron jobs to align with correct hour and min.

setup another cron job for 10:15, 13:15 and 19:15 timings.

15 10, 15 13, 15 19 * * * /tmp/myfile >/dev/null
Jorge Cocomess
Super Advisor

Re: Crontab Time Setting question

Got it!! No wonder I couldn't find it.

Thank you so much!!

Jorge