Interface to UNIX "at" program
| From: | Colin Viebrock | Date: | Tue, 09 Jan 2001 17:07:50 +0000 |
| Subject: | Interface to UNIX "at" program | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-891@lists.php.net to get a copy of this message | ||
I've got a class that interfaces with the "at" program, that I am
PEAR-ifing.
a) worth contributing?
b) where? Date::At? Or Cron::At? Or ... ?
FYI: here is the usage info from the un-PEAR-ed version ... which I
creatively called phat. :)
# USAGE:
#
# * First, read the man pages on at and atq. Since this class is
really
# just a fancy way of executing those shell commands, you should
understand
# how they work first.
#
# $at = new phat;
#
# This just instantiates the class.
#
# $at->at( string $cmd, string $timespec [, char $queue [, bool
$mail]] );
#
# This makes an "at" job, where $cmd is the shell command to
run
# and $timespec describes when the function should run. See
the
# at man page for a description of the spec.
#
# $queue is an optional 1 character string [a-zA-Z] that can
define
# which queue to put the job in.
#
# If $mail is set, then an email will be sent when the job
runs,
# even if the job doesn't output anything. The mail gets sent
to
# the user running the script (probably the webserver, i.e.
# nobody@localhost).
#
# The at() method returns false on error (in which case, check
# $at->error for the message), or the job number on success.
# On succes, $at->runtime is also set with the timestamp
corresponding
# to when the job will run.
#
# $at->atq( [char $queue] );
#
# This returns an array listing all queued jobs. The arrays
keys
# are the job numbers, and each entry is itself an associative
array
# showing the runtime (timestamp) and queue (char).
#
# If $queue is set, only jobs in that queue are listed.
#
# $at->atrm( $job )
#
# This removes jobs from the queue. Returns false if the job
doesn't
# exist, or true (since the atrm shell command doesn't seem to
report
# anything on success or failure).
#
#
#
--
Colin Viebrock
Co-Founder, easyDNS Technologies
http://www.easyDNS.com/