Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Re: Infinte perl script

by mr_leisure (Beadle)
on Jan 05, 2001 at 13:43 UTC ( [id://50024]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Infinte perl script
in thread Infinte perl script

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://50024]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found