Operating System - HP-UX
1833868 Members
1743 Online
110063 Solutions
New Discussion

cron in increments less than 1 minute?

 
SOLVED
Go to solution
RobertCarback
Frequent Advisor

cron in increments less than 1 minute?

Is it possible to use cron to run a job every 30 seconds?
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: cron in increments less than 1 minute?

Hi Robert:

The minimum granularity for crontasks is every minute. The only way you could accomplish this is to initiate your own script with a 30-second loop. Ths script would look like:

#/usr/bin/sh
while true
do

sleep 30
done

Regards!

...JRF...

Patrick Wallek
Honored Contributor

Re: cron in increments less than 1 minute?

No, it is not.

The only thing I can think of to do is something like:

while true
do
do your stuff here
do more stuff here
do even more stuff here
sleep 30
done

This would run your script, sleep 30 seconds and run again.

You could start this via at after the system reboots or via a startup script in /sbin/rc3.d after everything else starts.
RobertCarback
Frequent Advisor

Re: cron in increments less than 1 minute?

thanks. that answers my question