Compare commits

...

2 Commits

Author SHA1 Message Date
03955eecea * Tue Apr 30 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- create dedicated log files and logrotate [SME: 12664]
2024-04-30 16:28:32 -04:00
891fc73ce3 * Tue Apr 30 2024 Brian Read <brianr@koozali.org> 11.0.0-7.sme
- Remove use of hel command and replace by call to BlockDevices lib [SME: 12644]
2024-04-30 18:23:52 +01:00
8 changed files with 85 additions and 34 deletions

View File

@@ -47,6 +47,9 @@ for my $event ( qw( smeserver-manager-update smanager-refresh bootstrap-console-
event_link('systemd-default', "smeserver-manager-update", '88');
event_link('systemd-reload', "smeserver-manager-update", '89');
templates2events("/etc/rsyslog.conf", "smeserver-manager-update");
safe_symlink("restart",
"root/etc/e-smith/events/smeserver-manager-update/services2adjust/rsyslog");
use esmith::Build::Backup qw(:all);
backup_includes("smeserver-manager", qw(

View File

@@ -0,0 +1,4 @@
#smanager
:programname, isequal, "smanager" /var/log/smanager/smanager.log
& stop

View File

@@ -1,4 +1,6 @@
/usr/share/smanager/log/production.log {
/var/log/smanager/smanager.log {
su root root
create 600 root root
weekly
copytruncate
rotate 12

View File

@@ -7,7 +7,7 @@ After=network.target
Type=simple
SyslogIdentifier=smanager
WorkingDirectory=/usr/share/smanager/script
PIDFile=/var/run/smanager.pid
PIDFile=/run/smanager.pid
ExecStartPre=/sbin/e-smith/service-status smanager
ExecStart=/usr/bin/hypnotoad srvmngr -f
ExecStop=/usr/bin/hypnotoad -s srvmngr

View File

@@ -37,6 +37,8 @@ use esmith::BackupHistoryDB;
use esmith::util;
use esmith::lockfile;
use esmith::BlockDevices;
use constant DEBUG => $ENV{MOJO_SMANAGER_DEBUG} || 0;
our $cdb = esmith::ConfigDB->open || die "Couldn't open config db";
@@ -1576,19 +1578,33 @@ sub get_BackupwkDest_options {
my @usbdisks = ();
if ( $VFSType eq 'usb' ) {
foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem)) {
$udi =~ m/^(\S+)/;
my $devices = esmith::BlockDevices->new ('allowmount' => 'disabled');
my ($valid, $invalid) = $devices->checkBackupDrives(0);
my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted);
if ($is_mounted eq "false\n") {
my $vollbl = qx(hal-get-property --udi $1 --key volume.label);
$vollbl =~ m/^(\S+)/;
if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';}
chomp $vollbl;
push @usbdisks, $vollbl;
if ( ${$valid}[0] ) {
foreach ( @{$valid} ) {
push @usbdisks, $devices->label($_);
}
}
if (!$usbdisks[0]){
push (@usbdisks,$c->l('bac_No suitable local devices found'));
}
$devices->destroy;
#foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem)) {
#$udi =~ m/^(\S+)/;
#my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted);
#if ($is_mounted eq "false\n") {
#my $vollbl = qx(hal-get-property --udi $1 --key volume.label);
#$vollbl =~ m/^(\S+)/;
#if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';}
#chomp $vollbl;
#push @usbdisks, $vollbl;
#}
#}
# return undef unless ($usbdisks[0]);
}
@@ -1985,31 +2001,50 @@ sub dmount {
return ( qx(/bin/mount -t nfs -o nolock "$host:/$share" $mountdir 2>&1) );
}
elsif ($VFSType eq 'usb') {
my $device = "";
my $blkdev = "";
my $device = "";
my $vollbl = "";
foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem)) {
$udi =~ m/^(\S+)/;
my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted);
if ($is_mounted eq "false\n") {
$blkdev = qx(hal-get-property --udi $1 --key block.device);
if ($blkdev =~ m/^(\S+)/) {$blkdev = $1;}
}
if ($is_mounted eq "false\n") {
$vollbl = qx(hal-get-property --udi $1 --key volume.label);
$vollbl =~ m/^(\S+)/;
if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';}
}
my $devices = esmith::BlockDevices->new ('allowmount' => 'disabled');
my ($valid, $invalid) = $devices->checkBackupDrives(0);
chomp $vollbl;
chomp $blkdev;
$vollbl = "media/$vollbl";
if ($vollbl eq $share) {
$device = $blkdev;
}
if ( ${$valid}[0] ) {
foreach ( @{$valid} ) {
$vollbl = $devices->label($_);
if ( $share eq "media/$vollbl" ) {
$device = "/dev/$_";
}
}
}
return ( qx(/bin/mount $device "/$share" 2>&1) );
$devices->destroy;
return ( qx (mount $device /$share 2>&1) );
#-------------------------------------------------------------------------------------------------------
#my $device = "";
#my $blkdev = "";
#my $vollbl = "";
#foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem)) {
#$udi =~ m/^(\S+)/;
#my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted);
#if ($is_mounted eq "false\n") {
#$blkdev = qx(hal-get-property --udi $1 --key block.device);
#if ($blkdev =~ m/^(\S+)/) {$blkdev = $1;}
#}
#if ($is_mounted eq "false\n") {
#$vollbl = qx(hal-get-property --udi $1 --key volume.label);
#$vollbl =~ m/^(\S+)/;
#if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';}
#}
#chomp $vollbl;
#chomp $blkdev;
#$vollbl = "media/$vollbl";
#if ($vollbl eq $share) {
#$device = $blkdev;
#}
#}
#return ( qx(/bin/mount $device "/$share" 2>&1) );
#-------------------------------------------------------------------------------------------------------
} else {
return ("Error while mounting $host/$share : $VFSType not supported.\n");
}

View File

@@ -1,3 +1,4 @@
'bac_No suitable local devices found' => 'No suitable local devices found',
'bac_BACKUP_TITLE' => 'Backup or restore server data',
'bac_BACKUP_DESC' => '<P>The server provides two ways to back up and restore
your server: using your local desktop or a tape drive.</P>

0
root/var/log/smanager/.gitignore vendored Normal file
View File

View File

@@ -2,7 +2,7 @@ Summary: Sme server navigation module : manager 2
%define name smeserver-manager
Name: %{name}
%define version 11.0.0
%define release 6
%define release 8
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@@ -108,6 +108,12 @@ true
%defattr(-,root,root)
%changelog
* Tue Apr 30 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- create dedicated log files and logrotate [SME: 12664]
* Tue Apr 30 2024 Brian Read <brianr@koozali.org> 11.0.0-7.sme
- Remove use of hel command and replace by call to BlockDevices lib [SME: 12644]
* Mon Apr 29 2024 Brian Read <brianr@koozali.org> 11.0.0-6.sme
- Update layout for table extras [SME: 12656]