#!/usr/local/bin/perl use strict; use warnings; use lib qw/lib extlib/; my $config_file = '/var/www/htdocs/rss/config.cgi'; my $time_file = '/var/www/htdocs/rss/process_time.cgi'; my $update_file = '/var/www/htdocs/rss/update.cgi'; my $ptime; if ( open PROCESSTIME, $time_file ) { chomp( $ptime = ); $ptime ||= 0; system qq(perl $update_file) if &compare($ptime); close PROCESSTIME; } else { system qq(perl $update_file); } exit; sub compare { my $time = int time; my $ptime = int $_[0]; require MyUtils; my $config = MyUtils->config; return 0 if $time < $ptime + ( int $config->{span} * 60 * 60 ); return 1; } sub END { print "Content-Type: text/javascript\n\n"; } __END__