Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

a cron; in perl: Documentation

by belg4mit (Prior)
on Nov 17, 2001 at 05:13 UTC ( [id://125967]=note: print w/replies, xml ) Need Help??

in reply to a cron; in perl

=pod =head1 NAME cron - daemon to execute scheduled commands (Belga Cron) =head1 SYNOPSIS cron [B<-F> F<file>] [B<-L> I<log>] [B<-M>] [B<-O>] [B<-S>] [B<-U>] [B +<-X>] [B<-f> F<file>] [B<-h>] [B<-s>] [B<-x> [I<debugflag>]] =head1 DESCRIPTION Same as Vixie Cron blah blah blah. =head1 OPTIONS =over 4 =item B<-1> Exit after running through the list of jobs once. =item B<-F> F<crontab> Like B<-f> below except that it expects a user (6th) field. =item B<-L> I<log> Absolute path to write logs; files named errors, info, and warnings; i +n. There are two special values you can set B<-L> to =over 4 =item 0 no logging is done =item - output is sent to STDOUT =back =item B<-M> Repress all sending of mail. =item B<-O> To process a job B<cron> forks and then the specified command. With B<-O> commands denoted by C<#!perl -e> are C<eval>d by the child, saving the overhead of invoking a new interpreter when running perl sc +ripts; such jobs are ignored if B<-O> is not supplied. Even though this has been designed to be as safe as possible be sure you understand the potential security implications. =item B<-S> =cut XXX =pod Prevents magic open and rumored implict C<fork>, forces B<-U>. =item B<-U> This prevents setUID and setGID, that is it effectively ignores the GID environment variable as well as the user (6th) field of crontabs run as root or with B<-F>. =item B<-X> Prevents B<cron> from daemonizing; forces B<-s> and does not seperate from the terminal. =item B<-f> F<crontab> Supply a specific crontab or directory of crontabs to parse; ignoring the system default and spool directories. Especially useful for debugging or running multiple daemons. You might want to consider using B<-L> as well. =item B<-h> Print short usage message, and exit. =item B<-s> This prevents forking which forces B<cron> to serialize job processing +. This can produce unexpected results if you are setUIDing; running jobs via B<-F> or from F</etc/crontab> or F</etc/cron.d>. =item B<-x> [I<debugflag>] Log debugging information. =over 4 =item 1 basic status messages =item 2 crontab parsing messages =item 4 job checking messages =item 8 job output =back You may add the values together to form a composite mode. =back =head1 DIAGNOSTICS =over 4 =item Can't read from NULL device: AAA Couldn't open STDIN from your NULL device e.g; /dev/null. This is a common procedure for daemons. Don't you have a NULL? =item Couldn't chdir to ROOT directory: AAA Couldn't change to ROOT directory. This is a common procedure for daemons. Don't you have a root? =item Couldn't fork: AAA B<Cron> needs to C<fork> in order to handle all the SetUIDing it does for security. It tries to catch perls which cannot C<fork> and C<die>s, though a B<-X> will prevent this test. You may also get this error if your process table is full or there is insufficient memory to create a child to execute a job. The job was skipped. =item Couldn't open AAA: BBB B<Cron> was unable to open crontab AAA. =item Couldn't create pipe: AAA B<Cron> was unable to create a pipe which is necessary for embeded-newlines (%). The job was skipped. =item Couldn't setregid(AAA, BBB): CCC A child was unable to change from group ID(s) AAA to effective group ID(s) BBB before executing a job and exited. The job was skipped. =item Couldn't setreuid(AAA, BBB): CCC A child was unable to change from user ID AAA to effective user ID BBB before executing a job and exited. The job was skipped. =item Embedded newlines (%) not allowed with -s =back =head1 ENVIRONMENT B<Cron> uses nothing save PATH from it's environment. However crontabs may contain environment variable settings for jobs. See L<crontab(5)>. =over 4 =item CRON* These are a generalization of CRONLOG. They map to options and allow one to system-wide defaults in F</etc/defaults/cron>; =item CRONLOG Adopted from Sun's Cron which allows you to control logging with this setting in a crontab. This defaults to F</var/log/cron/>; and is equivalent to B<-L> I<log>. =item CRONDAEMON This defaults to YES; NO is equivalent to B<-X>. =item CRONDEBUG This defaults to NO; YES is equivalent to B<-x>. =item CRONEMBED This defaults to NO; YES is equivalent to B<-O>. =item CRONMAIL This defaults to YES; NO is equivalent to B<-M>. =item CRONONCE This defaults to NO; YES is equivalent to B<-1>. =item CRONSERIAL This defaults to NO; YES is equivalent to B<-s>. =item CRONUNSAFE This defaults to NO; YES is equivalent to B<-S>. =item GID Specify the groups the job process will be a member of; this is a colon delimited list like PATH. =item SUPATH Another extension from Sun's Cron. If SUPATH is set it is used in lieu of PATH for jobs run as root. =back =head1 FILES =over 4 =item F</etc/crontab> =item F</etc/cron.d/> =item F</var/spool/cron> OR F</var/spool/cron/crontabs> (Solaris) These are the default crontabs that list the jobs B<cron> is supposed +to run. See B<-f>. =item F</etc/default/cron> Adopted from Sun's Cron. System wide default settings, environment and options. NOTE: This file is only read at startup and not monitored for changes. =item F</var/log/cron/info> =item F</var/log/cron/warnings> =item F</var/log/cron/errors> B<Cron> logs its various messages to these files. See B<-L>. =back =head1 BUGS The crontab parser ought to be validating, and bail if it encounters something that doesn't look like a crontab. For now using crontab(1) is recommended, as it validates and will catch any errors avoiding nas +tiness. =head1 RESTRICTIONS Embedded newlines (%) in jobs require that your B<perl> implements C<p +ipe>. For hopefully obvious reasons; *cough* hashes *cough*; I<%> are not considered newlines for embedded perl jobs. Embedded perl (B<-O>) with B<-S> requires that you have File::Temp ins +talled. =head1 NOTES An interesting way to track jobs with GNU ps and grep is: ps aux -H | grep -A 2 -i crond =head1 SEE ALSO cron(8), crontab(1), crontab(5) =cut XXX run-parts =pod =head1 AUTHOR Jerrad Pierce <> =head1 HISTORY In case you hadn't noticed this is loosely modeled after Vixie Cron. You ought to be able to find that at F<> =head1 EXTENSIONS Almost every feature of Belga Cron is an extension of the original B<c +ron>. Most of them are specific to Belga Cron though some are derived from Sun's implementation and are denoted as such. In addition all extensions in Vixie Cron as of 3.0 are supported, except use of !, namely =over 4 =item lists and ranges can co-exist in the same field =item 3 letter abbreviations of English names for months and days may be use +d =item job output is mailed (or not) to a specified user =back =cut

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-07-19 11:15 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.