[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How Can I Schedule A Perl Script?



Hello

> I have a perl script that needs to be runned each 30
> minutes, how can I do this? Can I use cron? If so what
> would the configuration line would be? The path to the
> script is /home/user/doc/id.pl
You can use cron
crontab -e as normal user and
0,30 * * * * /home/user/doc/id.pl

or you can use sleep
sleep EXPR
sleep
Causes the script to sleep for EXPR seconds, or forever if no EXPR.
May be interrupted by sending the process a SIGALRM. Returns the 
number of seconds actually slept. You probably cannot mix alarm()
and sleep() calls, because sleep() is often implemented using 
alarm().

On some older systems, it may sleep up to a full second less than
what you requested, depending on how it counts seconds. Most modern
systems always sleep the full amount.

For delays of finer granularity than one second, you may use Perl's
syscall() interface to access setitimer(2) if your system supports
it, or else see select() below.

See also the POSIX module's sigpause() function. 

CU        
         
  Michael  
          
--                                                       
           Michael Ott, e-mail: michael@zolnott.de, www.zolnott.de           
I am registered as user #275453 with the Linux Counter, http://counter.li.org.

Attachment: pgpzeoyoMSF8O.pgp
Description: PGP signature


Reply to: