Operating System - HP-UX
1833770 Members
2684 Online
110063 Solutions
New Discussion

Schedule job every 20 seconds

 
SOLVED
Go to solution
Ranjit_3
Advisor

Schedule job every 20 seconds

Hi ,
How can i schedule jobs every 20 sec .I am able to do it by a script with sleep added , but by ( at / cron ) is there any possibility .

Thanks in advance ..
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: Schedule job every 20 seconds

No it is not possible to get down to seconds in granularity with cron/at jobs.

Your best bet is probably to do it just like you are with a sleep command. At least that way if 1 execution of the script hangs you will hopefully not have a bunch more trying to execute as well.
Lee Harris_5
Valued Contributor
Solution

Re: Schedule job every 20 seconds

Hi,

You should be able to do this with the at command...

For example, if you wanted the job to run every day of the week, every 20 seconds you should be able to use the -t switch, although you might have to setup three at jobs to run at 00 seconds, 20 seconds and 40 seconds...

at ... -t 2005-9901-1201-3100-2300-59.00
at ... -t 2005-9901-1201-3100-2300-59.20
at ... -t 2005-9901-1201-3100-2300-59.40

This would make the job run every 20 seconds, every single day from now until the year 2099.

HTH
Lee Harris_5
Valued Contributor

Re: Schedule job every 20 seconds

Sorry, I should have tested that command prior to posting, because it doesn't work!!

However, I think you could achieve what it is you are after by combining the use of at and cron. You could put together a script which runs an at job every 20 seconds, and then use cron to schedule that job to run every minute.

Sorry, don't have time to post any examples or test this out, but as previously stated, you probably would be better off just putting sleep commands into your script.

Ravi_8
Honored Contributor

Re: Schedule job every 20 seconds

Using cron or at scheduling for seconds is not possible.
never give up
Ranjit_3
Advisor

Re: Schedule job every 20 seconds

Hi ,
Thanks for your time and valuable comments .It seems that by at/cron it is not possible , so i will stick with sleep command only .I have assigned the points for your replies .

Bye...