initial commit of file from CVS for smeserver-check4updates on Sat Sep 7 20:13:39 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:13:39 +10:00
parent 9bb0dc3909
commit 684702b970
18 changed files with 660 additions and 2 deletions

View File

@@ -0,0 +1 @@
admin-yum

View File

@@ -0,0 +1 @@
daily

View File

@@ -0,0 +1 @@
configuration

View File

@@ -0,0 +1,28 @@
{
#used for smeserver-check4updates-0.0.3-1
#only needed because I made a mistake on the db name
#(check4update instead of check4updates)
use esmith::ConfigDB;
my $DB = esmith::ConfigDB->open or die ("can not open db configuration : $!");
my $check4update = $DB->get(check4update) or return;
my $repositories = $DB->get_prop_and_delete('check4update','repositories') || '';
my $excludes = $DB->get_prop_and_delete('check4update','excludes') || '';
my $emailaddress = $DB->get_prop_and_delete('check4update','emailaddress') || '';
my $frequence = $DB->get_prop_and_delete('check4update','frequence') || '';
$check4update->delete;
my %defaults = ('type' => 'configuration');
my $check4updates = $DB->get("check4updates") ||
$DB->new_record('check4updates' , \%defaults)
or die ("can not create check4updates key");
$check4updates->set_prop('repositories',"$repositories");
$check4updates->set_prop('excludes',"$excludes");
$check4updates->set_prop('emailaddress',"$emailaddress");
$check4updates->set_prop('frequence',"$frequence");
}

View File

@@ -0,0 +1,26 @@
{
return "\n# yum check for $check4updates{repositories} updates is disabled\n" unless $yum{status} eq 'enabled';
my $freq = $check4updates{frequence} || 'daily';
my $min;
my $dom;
my $dow;
if ($freq eq 'weekly') {
$min = 22;
$dom = '*';
$dow = 0;
} elsif ($freq eq 'monthly') {
$min = 42;
$dom = 1;
$dow = '*';
} else {
$min = 2;
$dom = '*';
$dow = '*';
}
return "$min 4 $dom * $dow root "
. q{sleep $[ $RANDOM \\% 3600 ]; /sbin/e-smith/check4repositoriesupdates -m };
}