Jump to content
G22

Crontab

Recommended Posts

How do I specify every 30 seconds? I ferget how to do this. I have every 1 minute currently. Thx.

 

*/1 * * * *

Share this post


Link to post
Share on other sites

I think you can only specify up to the minute in crontab, but instead of calling your program directly in crontab, you could have it call a script that does something like:

 

your_program

sleep 30

your_program

 

Or instead of using crontab you could have a script like this running constantly:

 

while true

do

your_program

sleep 30

done

Share this post


Link to post
Share on other sites

Steve solutions work. He's probably assuming your_program will spawn itself and returns right away; alternatively the script can put it in background (with your_program &). Otherwise the "duty cycle" may not be 30s, but something else, e.g. 38s if your_program takes 8s to complete.

Share this post


Link to post
Share on other sites

0/1 * * * * /scripts/foo.sh

0/1 * * * * sleep 30 /scripts/foo.sh

 

You can also call to a sleep script, but I seem to recall using the sleep command directly in crontab.

Share this post


Link to post
Share on other sites

Thx. It is really quite sad what I have to do (but it works)... log into our Cisco router (currently every minute) and flush the Dynamic NAT table since the router crashes almost immediately if I do not. Even at 1 minute currently, the router sometimes crashes between the minutes.

 

It is a temp fix until we get a better router and latest IOS.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×