Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to set cron job for 45 min time interval

Status
Not open for further replies.

vipinhcl

Programmer
Apr 21, 2010
30
0
0
US
Hi All,

I am not sure whether I am asking this on right forum or not but I have problem while setting the cron job.
I am trying to set the job run time for .sh file from every 1 hour to 45 min time interval, but unable to set the time.

I tried these two methods to set the time

0-59/45 * * * * * * * * exec /appl/prod/bin/test.sh >/dev/null 2>&1

*/45 * * * * * * * * exec /appl/prod/bin/test.sh >/dev/null 2>&1


and in both cases getting this error - crontab: error on previous line; unexpected character found in line.



Please suggest. Thanks in advance.

 
Hi. I'm not quite sure whether I fully understand what you want, but I don't think Solaris supports the 59/45 expression. Perhaps use * 45 * * * <command>?

The internet - allowing those who don't know what they're talking about to have their say.
 
Hi Ken,

Thanks for your reply. I need to run the job at 45 min time interval. For example if I set the test.sh file in cron starting at 00:00 then it should run at 00:00 AM then 00:45 AM then 01:30 AM then 02:15 AM then 03:00 AM then 03:45 AM etc. I mean at 45 minutes of time interval. To do this I used the above syntax but getting error. How can I do this?.

Please advice.
 
I see, thanks for clarifying. I think what I would do in such circumstances woul be to include a sleep 2700 in the script so that it loops every 45 minutes. You could then simply kick it off once from cron (or init) and let it do it's stuff.

The internet - allowing those who don't know what they're talking about to have their say.
 
Hmm... that would be an good option.

Thanks for your reply.
 
Or you can make a wrapper and run every 15 minute:

* 0,15,30,45 * * * <command>?


And the you call the other script every third time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top