谢谢,  还是写简单的吧

装模块也烦



2010/4/16 cnhack TNT <[email protected]>

> 忘了提, CPAN 上还有个 Schedule::Cron 模块,可以干和 Cron 一样的事儿
>
> 2010/4/16 cnhack TNT <[email protected]>
>
> 你可以这么写:
>>
>> $SIG{ALRM} = sub {
>>     print scalar time,"\n";
>>     alarm(3); # 设定3秒间隔
>> };
>>
>> alarm(1); # 只是为了激活 timer
>> sleep while 1;
>>
>> 你也可以用 while(1){sleep(XXX);} 来定时,
>> 精度要求高的话可以用上 Time::HiRes 模块
>> 一般对精度要求不高但希望程序终止后,再运行还能较正确地计算间隔的话,生成一个临时文件,用 while 循环结合 sleep(为了不让CPU满载),
>> 再结合 stat 来判断这个文件的修改时间和当前时间间隔,从而实现定时器的功能,这种方式会比较方便。
>>
>> 2010/4/16 Michael Zeng <[email protected]>
>>
>>   因为没有crontab权限 , 想写个 脚本定时运行某个perl 脚本
>>>
>>> 怎写? 如每隔1小时运行 A.pl
>>>
>>> 是这样么,不记得了,
>>>
>>>
>>> alarm ( 3600 )  ;
>>>
>>> $SIG{ ALM }  =  sub  {
>>>      system "perl  A.pl " ;
>>>      alarm ( 3600 ) ;
>>> }
>>>
>>> ?
>>>
>>> --
>>>            Yours Sincerely
>>>                    Zeng Hong
>>>
>>> --
>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> 要取消订阅此网上论坛,请发送电子邮件至 
>>> [email protected]<perlchina%[email protected]>
>>> 。
>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>
>>
>>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>



-- 
           Yours Sincerely
                   Zeng Hong

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复