Beta Shell
v2.0 ยท web2.us.cloudlogin.co
[FM]
[CMD]
[PHP]
[DB]
[INFO]
[SEC]
File Manager
~
/
usr
/
share
/
doc
/
perl-Schedule-Cron
/
examples
Upload
5 items
Name
Size
Perms
Modified
Actions
[ .. / .. ]
cron.tab
95 B
-rw-r--r--
2011-06-06 10:12:08
Edit
Del
custom_sleep.pl
11.36 KB
-rw-r--r--
2011-06-06 10:12:08
Edit
Del
simple.pl
861 B
-rw-r--r--
2011-06-06 10:12:08
Edit
Del
Editing: simple.pl
(861 B)
Path: /usr/share/doc/perl-Schedule-Cron/examples/simple.pl
Back
#!/usr/bin/perl # Very simple examples which print the current # time every 10 Minutes. # # The purpose is to show a common usage pattern # using a single dispatcher subroutine provided # at construction time use lib "../lib"; use Schedule::Cron; # Create new object with default dispatcher my $cron = new Schedule::Cron(\&dispatcher); # The cron entry which fires every 10 minutes my $entry = "0-59/5 * * * *"; # Dispatcher subroutine called from cron sub dispatcher { open(T,">>timestamps.txt"); print T "Current: ",scalar(localtime),"\n"; print T "Next: ",scalar(localtime($cron->get_next_execution_time($entry))),"\n"; close T; sleep(30); } # Call &dispatcher() every ten minutes $cron->add_entry($entry); # Run scheduler and block. 'nofork' forces the subroutine to # be called in the main process $cron->run(nofork=>1);