Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cron like function ?

Status
Not open for further replies.

sumncguy

IS-IT--Management
May 22, 2006
118
0
0
US

The unix admin folks choose not to give me cron or at access ...

Does Perl have a way of looking at a pcs clock and kicking off a script .. that is that isnt too hard for a wanna be rookie like me to setup :)

Thanks alot folks

 
time? sleep?

And then just starting the script as a daemon?

Certainly not ideal, but it would work.

- Miller
 
perl has no way to look at the system time. You have to get a perl script running before it can do anything. Conventional practice is:

Code:
while(1){
    check time here
    if (its time) {
        do your thing
    }
    else {
        sleep(n);
        next;
    }
}

but this script will never end unless you put in some type of condition to break it out of the "while" loop or you shut it down. But if the system is setup to monitor how long scripts run it might be killed off by the system.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
This may work, you would need to get the class ParseCron.

Code:
use FB::ParseCron;

sub checkCron
{
   my ($function,$client) = @_;
   my %hash = %{$function};
   my $value = $hash{CRON}[0];
   my $c;
   if ($value)
     {
        $c = FB::ParseCron->new($value);
     }
   if ($c->now)
        {
         return 0;
         }
   return 1;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top