PDA

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



robfindlay
March 22nd, 2009, 10: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, 11:02 PM
#!/bin/bash

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

robfindlay
March 23rd, 2009, 12:03 AM
#!/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 23rd, 2009, 12:38 AM
does the integer of 30 ALWAYS mean 30 seconds?


Seconds is the default, yes.

man sleep

monkeyking
March 23rd, 2009, 12:48 AM
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