home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
2.x
/
plum2_15_2.lzh
/
module
/
sys
/
timer.plm
< prev
Wrap
Text File
|
1998-01-13
|
3KB
|
91 lines
# <!-- -*- perl -*-
# $Id: timer.plm,v 2.1 1998/01/13 23:29:16 hasegawa Exp $
# copyright (c)1997 pupu_j <hasegawa@agusa.nuie.nagoya-u.ac.jp>
package sys_timer;
$FORMAT = '%Y/%m/%d %H:%M:%S';
$_ = 'sys_timer';
sub main_loop {
local($userno) = @_;
local($regex, $str, $date, $time, $exec);
$now = &'date($FORMAT);
foreach $last (&'array($timerlist[$userno])) {
$regex = &'regex($last);
next if $now =~ /$regex/;
$timerlist[$userno] = &'remove($timerlist[$userno], $last);
}
foreach $timer (&'property($userno, 'exec')) {
($date, $time, $exec) = split(/\s+/, $timer, 3);
$str = $date . ' ' . $time;
$regex = &'regex($str);
next unless $now =~ /$regex/;
$addlist[$userno] = &'add($addlist[$userno], $str);
next if &'exist($timerlist[$userno], $str);
system($exec);
}
$timerlist[$userno] = &'add($timerlist[$userno], &'array($addlist[$userno]));
}
__END__
--><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE> sys/timer.plm </TITLE></HEAD><BODY>
$B%*%s%i%$%s%I%-%e%a%s%H(B
<HR><H3> $BL>A0(B </H3>
sys/timer.plm - $B;XDj$5$l$?;~4V$K;XDj$5$l$?%3%^%s%I$r<B9T$9$k(B
<HR><H3> $B@bL@(B </H3>
$B;XDj$5$l$?;~4V$K$J$k$H;XDj$5$l$?%3%^%s%I$r<B9T$7$^$9!#(B
UNIX$B0J30$G$O;HMQ$G$-$^$;$s!#(B
<HR><H3> $B%W%m%Q%F%#(B </H3>
<DL>
<DT> sys.timer.exec* $BF|IU(B $B;~4V(B $B%3%^%s%I(B
<DD> $B%3%^%s%I$r<B9T$9$kF|IU!";~4V$H<B:]$N%3%^%s%I$r;XDj$7$^$9!#(B
$BF|IU!";~4V!"%3%^%s%I$O$=$l$>$l6uGr$G6h@Z$j$^$9!#(B
$BF|IU$O(B1970/01/01$B!";~4V$O(B00:00:00$B$N%U%)!<%^%C%H$G!"(B
$B$=$l$>$l%o%$%k%I%+!<%I$H$7$F(B*$B$H(B?$B$,;XDj$G$-$^$9!#(B
$B%3%^%s%I$K$O(Bperl$B$NJ8$G$O$J$/!"(B
$B<B9T%U%!%$%k$d%9%/%j%W%H$r;XDj$7$F2<$5$$!#(B
$B$^$?!";~4V$N;XDj$O$"$kDxEY$NI}$r;}$C$F;XDj$9$k$h$&$K$7$F2<$5$$!#(B
00:00:00$B$N$h$&$K87L)$K;XDj$9$k$H!"<B9T$5$l$k$3$H$O$^$:$"$j$^$;$s!#(B
</DL>
<HR><H3> $B@_DjNc(B </H3>
<PRE>
+ sys/timer.plm
sys.timer.exec: */01/01 *:*:* echo 'A happy new year' | mail hasegawa
</PRE>
$BKhG/(B1$B7n(B1$BF|$K$J$k$H!"!V(Becho 'A happy new year' | mail hasegawa$B!W(B
$B$H$$$&%3%^%s%I$r<B9T$7$^$9!#(B
$B$3$l$O!V(BA Happy new year$B!W$H$@$1=q$+$l$?%a!<%k$r(Bhasegawa$B08$KAw$j$^$9!#(B
<PRE>
+ sys/timer.plm
sys.timer.exec: */*/* 00:*:* logmail
</PRE>
$BKhF|(B0$B;~$K$J$k$H!"!V(Blogmail$B!W$H$$$&%3%^%s%I$r<B9T$7$^$9!#(B
<PRE>
+ sys/timer.plm
sys.timer.exec: */*/* *:*:* echo start plum
</PRE>
$B5/F0;~$K0l2s$@$1!V(Becho start plum$B!W$H$$$&%3%^%s%I$r<B9T$7$^$9!#(B
</BODY></HTML>