Make sytem status cron job use webmincron

This commit is contained in:
Jamie Cameron
2010-05-13 17:57:45 -07:00
parent 9cdb3d128c
commit b69e57cc86
3 changed files with 31 additions and 24 deletions

View File

@@ -439,5 +439,33 @@ if (!$config{'collect_notemp'} &&
return @rv;
}
# scheduled_collect_system_info()
# Called by Webmin Cron to collect system info
sub scheduled_collect_system_info
{
my $start = time();
# Make sure we are not already running
if (&test_lock($collected_info_file)) {
print STDERR "scheduled_collect_system_info : Already running\n";
return;
}
# Don't diff collected file
$gconfig{'logfiles'} = 0;
$gconfig{'logfullfiles'} = 0;
$WebminCore::gconfig{'logfiles'} = 0;
$WebminCore::gconfig{'logfullfiles'} = 0;
$no_log_file_changes = 1;
&lock_file($collected_info_file);
$info = &collect_system_info();
if ($info) {
&save_collected_info($info);
&add_historic_collected_info($info, $start);
}
&unlock_file($collected_info_file);
}
1;

View File

@@ -5,26 +5,5 @@
package system_status;
$main::no_acl_check++;
require './system-status-lib.pl';
$start = time();
# Make sure we are not already running
if (&test_lock($collected_info_file)) {
print "Already running\n";
exit(0);
}
# Don't diff collected file
$gconfig{'logfiles'} = 0;
$gconfig{'logfullfiles'} = 0;
$WebminCore::gconfig{'logfiles'} = 0;
$WebminCore::gconfig{'logfullfiles'} = 0;
$no_log_file_changes = 1;
&lock_file($collected_info_file);
$info = &collect_system_info();
if ($info) {
&save_collected_info($info);
&add_historic_collected_info($info, $start);
}
&unlock_file($collected_info_file);
&scheduled_collect_system_info();

View File

@@ -4,10 +4,10 @@ Functions for creating and listing Webmin scheduled functions.
=cut
# XXX actually call in miniserv.pl
# XXX keep track of last call time
# XXX UI
# XXX support cron-style time specs
# XXX make sure temp files are cleaned up
# XXX switch all cron jobs at install time
BEGIN { push(@INC, ".."); };
use WebminCore;