home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula
/
nebula.bin
/
SourceCode
/
CronVixie2.1
/
atinmin
next >
Wrap
Text File
|
1992-07-23
|
1KB
|
29 lines
#!/usr/local/bin/perl
# vi:se wm=0 sw=4 ts=4:
# run an "at" job N minutes from now, from the command line
# Copyright 1992 Irving_Wolfe@Happy-Man.com. Permission is hereby granted,
# provided that this notice and my ad at the bottom are not removed, for
# unlimited internal use and no-charge redistribution to anyone. If you
# change it, please add a line mentioning that you did so.
$sec = 60 * shift;
die "usage: $0 minutes <rest of at command>,\n quitting" unless $sec > 0;
# build the command to run and arrange to get its output by mail
$rawCmd = join(' ', @ARGV);
($user, $junk) = getpwuid($>);
$runCmd = "F=/tmp/am\$\$;export F;$rawCmd 2>&1 >\$F;if test -s \$F;then <\$F /usr/ucb/Mail -n -s 'atjob: $rawCmd' $user;fi;rm -f \$F";
# build the "at" command
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time + $sec);
$mon = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")[$mon];
$atCmd = sprintf(qq/|at -s %02d%02d %s %d/, $hour, $min, $mon, $mday);
open(atCmd) || die "$0: could not open $atCmd,\n quitting";
print atCmd "$runCmd\n";
__END__
# Irving_Wolfe@Happy-Man.com Happy Man Corp. 206/463-9399 x101
# 4410 SW Pt. Robinson Rd., Vashon Island, WA 98070-7399 fax x108
# We publish SOLID VALUE for the intelligent investor. NextMail OK
#Info free; sample $20: Send POSTAL addr: Solid-Value@Happy-Man.com