SUPER simple bash script to repeat a command...

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

A quick way would be using an infinite loop ...

#!/bin/bash

while :
 
 do

   igal -a -r -U -w 6

   sleep 30

 done
period=${1:-60} ## default to every 60 seconds
while :
do
  sleep $period &
  igal -a -r -U -w 6
  wait
done

Or, put an entry in your contab file.

Or, if you have the watch command:

watch -n "$period"  igal -a -r -U -w 6

etc., etc., etc....

WATCH!!!! i was trying to remember that buggerin thing! Though writing a script is good learnin....

Thanks guys!

-Rob

Using the watch command, is there a way to echo the output to a logfile?

I run root-tail on my desktop and would like to see the result show up their.

Generically speaking, what is the bash script syntax that will echo any output that normally wouldn't be displayed--I know it's broad and vague, sorry.

Lastly, does anyone know which logfile has the unix/linux system main console? If I'm not mistaken doesn't every application echo something somewhere? E.g. when you launch say firefox from the bash prompt you all kinds of output, isn't this and all aps echo some kind of content to a "core" log file?

Thanks!

-Rob

watch <your comand> | tee logfile

If there's output, it will be displayed unless you (or the application) redirect the output somewhere else, or if there's no controlling terminal.

Check the files in /var/log/ and the dmesg command

No.

No.

Thank you!! I forgot how much of a newb I am :frowning: