diff -Nur smeserver-affa-3.2.2.3.old/root/etc/affa/sample_SME_SME.conf.sample smeserver-affa-3.2.2.3/root/etc/affa/sample_SME_SME.conf.sample --- smeserver-affa-3.2.2.3.old/root/etc/affa/sample_SME_SME.conf.sample 2015-09-22 22:25:38.000000000 +0200 +++ smeserver-affa-3.2.2.3/root/etc/affa/sample_SME_SME.conf.sample 2016-03-24 20:53:59.000000000 +0100 @@ -19,4 +19,4 @@ weeklyKeep=4 monthlyKeep=12 yearlyKeep=1 -status=enbabled +status=enabled diff -Nur smeserver-affa-3.2.2.3.old/root/etc/affa/sample_SME_usb.conf.sample smeserver-affa-3.2.2.3/root/etc/affa/sample_SME_usb.conf.sample --- smeserver-affa-3.2.2.3.old/root/etc/affa/sample_SME_usb.conf.sample 2015-09-22 22:25:38.000000000 +0200 +++ smeserver-affa-3.2.2.3/root/etc/affa/sample_SME_usb.conf.sample 2016-03-24 20:53:59.000000000 +0100 @@ -22,4 +22,4 @@ weeklyKeep=4 monthlyKeep=12 yearlyKeep=1 -status=enbabled +status=enabled diff -Nur smeserver-affa-3.2.2.3.old/root/etc/e-smith/templates/etc/smb.conf/95Affa smeserver-affa-3.2.2.3/root/etc/e-smith/templates/etc/smb.conf/95Affa --- smeserver-affa-3.2.2.3.old/root/etc/e-smith/templates/etc/smb.conf/95Affa 1970-01-01 01:00:00.000000000 +0100 +++ smeserver-affa-3.2.2.3/root/etc/e-smith/templates/etc/smb.conf/95Affa 2016-03-24 20:53:59.000000000 +0100 @@ -0,0 +1,3 @@ +# WARNING: don't remove the # of the following section! +#[Affa-jobs] + diff -Nur smeserver-affa-3.2.2.3.old/root/sbin/affa smeserver-affa-3.2.2.3/root/sbin/affa --- smeserver-affa-3.2.2.3.old/root/sbin/affa 2015-09-22 22:25:38.000000000 +0200 +++ smeserver-affa-3.2.2.3/root/sbin/affa 2016-04-22 21:16:37.577000581 +0200 @@ -10,7 +10,7 @@ # This is free software, and you are welcome to redistribute it # under certain conditions; type 'affa --license' for details. #---------------------------------------------------------------------- -my $VERSION='3.2.2.2-0'; +my $VERSION='3.2.2.3-3'; #---------------------------------------------------------------------- use strict; @@ -104,7 +104,9 @@ sub jobsnrpe($); sub logTail(); sub mailTest(); -sub mount($$$); +###### ligne suivante modifiée umount diskusage - bug 9147 +# sub mount($$$); +sub mount($$$%); sub moveArchive(); sub moveFileorDir($$); sub nrpe(); @@ -491,7 +493,9 @@ # mount root dir if( $job{'AutomountDevice'} and $job{'AutomountPoint'} ) { - mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'} ); +###### ligne suivante modifiée umount diskusage - bug 9147 +# mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'} ); + mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'}, %job ); } affaErrorExit("RootDir $job{'RootDir'} does not exist") unless -d $job{'RootDir'}; @@ -934,7 +938,7 @@ ############################## ajout modifs $sshQuiet = $job{'Debug'} eq 'yes' ? '' : '-q'; ############################# fin modifs -############################################################################################################################################# +############################################################################################################################################### # get Done Dates if( $jobname ) { $job{'_sshOpts'}="-p $job{'sshPort'} -o CheckHostIP=no -o StrictHostKeyChecking=no -o HostKeyAlias=$jobname -o UserKnownHostsFile=/root/.ssh/knownhosts-$jobname" . ($job{'Debug'} ne 'yes' ? ' -q' : ''); @@ -1960,8 +1964,7 @@ } else { # ($h = sprintf "+-%076s-+\n", '-') =~ s/0/-/g; # ligne du patch Affa2 ci dessous - ($h = sprintf "+-%0102s-+\n", '-') =~ s/0/-/g; - + ($h = sprintf "+-%0110s-+\n", '-') =~ s/0/-/g; } $out2 .= $h; $out = $out.$out2; @@ -1977,6 +1980,15 @@ affaErrorExit( "$txt" ); } my %job=getJobConfig( $jobname ); + +# automount root dir - fixing bug 9147 + if( $job{'AutomountDevice'} and $job{'AutomountPoint'} ) + { + mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'}, %job ); + } + affaErrorExit("RootDir $job{'RootDir'} does not exist") unless -d $job{'RootDir'}; + + my @out = ('Archive:Count;Date;Files;Size;RootDirFilesystemAvail;RootDirFilesystemUsed;valid;TotalBytesReceived;ExecutionTime;DedupTotalFiles;DedupReplacedFiles;DedupSavedBytes;DedupExectime;DedupDate'); my %js; my %js2; @@ -2059,6 +2071,12 @@ . ";". $DedupDate ); } + +# auto-unmount - fixing bug 9147 + my $dev=$job{'AutomountDevice'}; + my $mountPoint=$job{'AutomountPoint'}; + unmount($dev,$mountPoint) if $dev and $mountPoint; + return @out; } @@ -2217,6 +2235,14 @@ next if $jobname eq 'GlobalAffaConfig'; my %job=getJobConfig($jobname); +# automount root dir - fixing bug 9147 + if( $job{'AutomountDevice'} and $job{'AutomountPoint'} ) + { + mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'}, %job ); + } + affaErrorExit("RootDir $job{'RootDir'} does not exist") unless -d $job{'RootDir'}; + + my $rptfile=$job{'RootDir'}."/$jobname/scheduled.0/.AFFA3-REPORT"; my $rpt; $rpt= Config::IniFiles->new( -file => $rptfile ) if( -f $rptfile ); @@ -2291,6 +2317,12 @@ my $nof = sprintf "%2d,%2d,%2d,%2d,%2d", $acnt{'scheduled'}, $acnt{'daily'}, $acnt{'weekly'}, $acnt{'monthly'}, $acnt{'yearly'}; push( @out, "$jobname;$status;$lastrun;$netxrun;$TotalFileSize;$avail;$used;$nof;$lock;$state;$BackupTime;$DedupTotalFiles;$DedupReplacedFiles;$DedupSavedBytes;$DedupExectime;$DedupDate"); } + + # auto-unmount - fixing bug 9147 + my $dev=$job{'AutomountDevice'}; + my $mountPoint=$job{'AutomountPoint'}; + unmount($dev,$mountPoint) if $dev and $mountPoint; + return @out; } @@ -2376,7 +2408,9 @@ my $mountPoint = $job{'AutomountPoint'}; my $mountOptions = $job{'AutomountOptions'}; if( $RootDir && $mountPoint && $RootDir =~ /$mountPoint/ ) { - mount($dev,$mountPoint, $mountOptions) if $dev and $mountPoint; +###### ligne suivante modifiée umount diskusage - bug 9147 +# mount($dev,$mountPoint, $mountOptions) if $dev and $mountPoint; + mount($dev,$mountPoint, $mountOptions, %job) if $dev and $mountPoint; ($used, $avail) = df( $RootDir) if isMounted($dev,$mountPoint); unmount($dev,$mountPoint) if $dev and $mountPoint; } elsif( $RootDir && -x $RootDir ) { @@ -2422,8 +2456,11 @@ return $result; } -sub mount($$$) { - (my $dev, my $AutomountPoint, my $options) = @_; +###### 2 lignes suivantes modifiées umount diskusage - bug 9147 +# sub mount($$$) { +# (my $dev, my $AutomountPoint, my $options) = @_; +sub mount($$$%) { + (my $dev, my $AutomountPoint, my $options, my %job) = @_; $AutomountPoint =~ s/\/$//; return if isMounted( $dev, $AutomountPoint ); File::Path::mkpath( $AutomountPoint, 0, 0700 ) if not -d $AutomountPoint; @@ -2438,9 +2475,10 @@ } } $autoMounted{$AutomountPoint}=$dev if $job{'AutoUnmount'} eq 'yes'; + } -sub unmount($$) { + sub unmount($$) { (my $dev, my $AutomountPoint) = @_; $AutomountPoint =~ s/\/$//; return if not $autoMounted{$AutomountPoint} or $autoMounted{$AutomountPoint} ne $dev or not isMounted( $dev, $AutomountPoint ); @@ -2802,7 +2840,9 @@ my %job=getJobConfig( $jobname ); if( $job{'AutomountDevice'} and $job{'AutomountPoint'} ) { - mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'} ); +###### ligne suivante modifiée umount diskusage - bug 9147 +# mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'} ); + mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'}, %job ); } # check if a job is running @@ -2837,7 +2877,7 @@ if ($job{'SMEServer'} ne 'no') { - print 'SME-server= ' . $job{'SMEServer'} . "\n"; +#pour debbugage print 'SME-server= ' . $job{'SMEServer'} . "\n"; my $prerestore='SME/signal-pre-restore'; if ($job{'remoteHostName'} eq 'localhost') { @@ -2847,7 +2887,7 @@ { execJobCommandRemote($jobname,$prerestore); } - print 'pre-restore: $prerestore' . "\n"; +#pour debbugage print 'pre-restore: $prerestore' . "\n"; } @@ -2896,7 +2936,7 @@ ################################## penser à rajouter le imapIndexFilesDelete(); cf AffaV2 -print 'SME-server= ' . $job{'SMEServer'} . "\n"; +#pour debbugage print 'SME-server= ' . $job{'SMEServer'} . "\n"; my $postupgrade='SME/signal-post-upgrade-reboot'; if ($job{'remoteHostName'} eq 'localhost') { @@ -2906,7 +2946,7 @@ { execJobCommandRemote($jobname,$postupgrade); } - print 'post-upgrade + reboot: $postupgrade' . "\n"; +#pour debbugage print 'post-upgrade + reboot: $postupgrade' . "\n"; } @@ -3359,7 +3399,8 @@ unlink $1; } print FW "$_\n" if not $_ =~ /(include = \/etc\/samba\/Affa-Job|# Affa archives. Updated on)/; - if( $_ =~ /^\[global\]$/i ) { +# ligne d'origine - Bug 9298 - if( $_ =~ /^\[global\]$/i ) { + if( $_ =~ /^#\[Affa-jobs\]$/i ) { printf FW "# Affa archives. Updated on " .formatHTime(Date::Format::time2str("%Y%m%d%H%M",time())) . "\n"; print FW join("\n", sort keys %inc)."\n"; } @@ -3852,7 +3893,9 @@ if( $job{'AutomountDevice'} and $job{'AutomountPoint'} ) { - mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'} ); +###### ligne suivante modifiée umount diskusage - bug 9147 +# mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'} ); + mount( $job{'AutomountDevice'}, $job{'AutomountPoint'}, $job{'AutomountOptions'}, %job ); } # check if archive exists @@ -4056,7 +4099,8 @@ { ########### $Affa::lib::ExecCmdOutout =~ /(Total file size: [0-9]* bytes)/gm; $ExecCmdOutout =~ /(Total file size: [0-9]* bytes)/gm; - print "OK. $1\n"; +########## print "OK. $1\n"; ##### Bug 9139: valeur de $1 non définie. + print "OK. \n"; } else {