#!/usr/local/bin/perl # edit_sched.cgi # Find the logrotate cron job, or offer to create one require './logrotate-lib.pl'; &ui_print_header(undef, $text{'sched_title'}, ""); print "

",&text('sched_desc', "$config{'logrotate'}"),"

\n"; # Find the job, looking in daily directories too &foreign_require("cron", "cron-lib.pl"); @jobs = &cron::list_cron_jobs(); JOB: foreach $j (@jobs) { if ($j->{'command'} =~ /logrotate/i) { $job = $j; last JOB; } local $rpd = &cron::is_run_parts($j->{'command'}); if ($rpd) { local @exp = &cron::expand_run_parts($rpd); foreach $e (@exp) { if ($e =~ /logrotate/i && -r $e) { $job = $j; $runparts = $e; last JOB; } } } } if ($runparts) { # Run from run-parts command, cannot touch print &text('sched_runparts', "$runparts", &cron::when_text($job)),"

\n"; } else { # Offer to enable/change/delete print "

\n"; print "\n"; print "$text{'sched_sched'}\n"; printf " %s\n", $job ? "" : "checked", $text{'sched_disabled'}; printf " %s
\n", $job ? "checked" : "", $text{'sched_enabled'}; $job ||= { 'special' => 'daily' }; print "\n"; &cron::show_times_input($job); print "
\n"; print "
\n"; } &ui_print_footer("", $text{'index_return'});