On Wed, 2002-04-17 at 14:45, drieux wrote:
<snip />
> 
> shame on you chas.....
> 
> that's a run away script - since you have no throttler
> in it at all and it will only 'slow down' while actually
> executing your system call.
<snip />

Oopsy, forgot the sleep call.  That is what I get for just posting code
without testing it first.  Well, I did say something like this <grin
/>.  Maybe it should look more like this (actually it shouldn't, you
_should use cron or the NT equivalent):

#!/usr/bin/perl
#WARNING UNTESTED CODE
#WARNING UNTESTED CODE
#WARNING UNTESTED CODE

#BIG WARNING --> Has problems with ST vs DT  <-- BIG WARNING
#BIG WARNING --> Don't try to use around 2am <-- BIG WARNING

use strict;

my $terminate = 0;

$SIG{TERM} = sub { $terminate = 1 };

my $forked = fork;

exit 0 if $forked;

die "horrible death" unless defined $forked;

my $last_run = (localtime)[3];
until ($terminate) {
        my ($sec, $min, $hour, $today) = localtime();
        if ($hour = 0 and $last_run < $today) {
                $last_run = $today;
                system('script args args');
        }
        ($sec, $min, $hour) = localtime();
        #(roughly a day) - current time
        sleep 86400 - ($sec + $min * 60 + $hour * 60);
}
 
-- 
Today is Boomtime the 34th day of Discord in the YOLD 3168
Hail Eris, Hack Linux!

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to