Howdy -
This is my first attempt at an answer to a question so go easy on me if i screw it up folks :P
I have a chunk of code that runs a df command on a specified directory, and will loop every x seconds as you choose. You can find it
here for your reference ( the part you need is in the second script , ds.pl).
For quickness, the code i use to loop it is -
until (! $opt{time}) { # loop every specified seconds
{ check_disk_space($opt{dir} ) ; # run my df subroutine on specified d
+irectory
sleep ($opt{time}) # wait specified time, then begin again
}
What this basically does is uses the
GetOpt::Long module to accept and process command-line parameters entered by the user, and then uses the
untilstatement to run the loop according to the parameters entered.
So what you could do in theory is put a line in your cron to start it (
rjoseph.pl -dir =/usr/bin/perl -time=120) which would then run the script every two minutes on the /usr/bin/perl directory.
As I said, this is my first *serious* answer, so if I have rambled, I apologise, but I sincerely hope this helps, if only on the sleep thing. I hope you like Getopt though, cause it's been totally handy for me.
Cheers,
jim
if ($mr_leisure) { bow; }
this is still not finished