PDA

View Full Version : SUPER simple bash script to repeat a command...


robfindlay
March 22nd, 2009, 05:45 PM
I need to repeat this command on a configurable interval:

igal -a -r -U -w 6

I tried this:

#!/bin/bash

igal -a -r -U -w 6

sleep 30


Just a guess that it MIGHT work.

Can anyone point me in the right direction?

-R

stroyan
March 22nd, 2009, 06:02 PM
#!/bin/bash

while sleep 30
do
igal -a -r -U -w 6
done

robfindlay
March 22nd, 2009, 07:03 PM
#!/bin/bash

while sleep 30
do
igal -a -r -U -w 6
done


THANK YOU!

does the integer of 30 ALWAYS mean 30 seconds?


-Rob

geirha
March 22nd, 2009, 07:38 PM
does the integer of 30 ALWAYS mean 30 seconds?


Seconds is the default, yes.
man sleep

monkeyking
March 22nd, 2009, 07:48 PM
you should also be able to use 'watch' instead
like


watch igal -a -r -U -w 6

or if you want the 30 sec interval


watch -n 30 igal -a -r -U -w 6