1 |
diff -ruN smeserver-affa-3.3.1.old/root/sbin/affa smeserver-affa-3.3.1/root/sbin/affa |
2 |
--- smeserver-affa-3.3.1.old/root/sbin/affa 2021-03-29 14:48:44.000000000 +0200 |
3 |
+++ smeserver-affa-3.3.1/root/sbin/affa 2021-09-21 17:09:30.045265189 +0200 |
4 |
@@ -11,8 +11,24 @@ |
5 |
# under certain conditions; type 'affa --license' for details. |
6 |
#---------------------------------------------------------------------- |
7 |
my $VERSION = '3.3.1'; |
8 |
+ |
9 |
# This will remove the trailing -1 release number for docs |
10 |
-my $shortVersion =~ s/-[0-9]+// ; |
11 |
+my $shortVersion = $VERSION; |
12 |
+$shortVersion =~ s/-[0-9]+//; |
13 |
+ |
14 |
+ |
15 |
+#---------------------------------------------------------------------- |
16 |
+# |
17 |
+# A few notes - 21/09/2021 |
18 |
+# |
19 |
+# This is a huge script and probably needs breaking up |
20 |
+# It probably has lots that can be cleaned or removed |
21 |
+# It is starting to become systemd aware, but |
22 |
+# SME is still not fully systemd manageable and stil relies |
23 |
+# on some old init scripts |
24 |
+# |
25 |
+# I have built freedup for SME v10 in my reetp test repo |
26 |
+# No idea if it works |
27 |
#---------------------------------------------------------------------- |
28 |
|
29 |
use strict; |
30 |
@@ -38,6 +54,9 @@ |
31 |
# ajout pour V3.2.2-2 |
32 |
use File::Basename; |
33 |
|
34 |
+# Added for 3.3.1 |
35 |
+use esmith::Service; |
36 |
+ |
37 |
#use Affa::lib qw(ExecCmd setlog lg dbg); |
38 |
########use Affa::lib qw(ExecCmd setlog lg dbg); |
39 |
|
40 |
@@ -66,7 +85,7 @@ |
41 |
sub cleanup(); |
42 |
sub convertReportV2toV3($$); |
43 |
sub cronSetup(); |
44 |
-sub dbg($); |
45 |
+# sub dbg($); reetp - duplicate |
46 |
sub dbg($); |
47 |
sub deduplicate($); |
48 |
sub deleteJob(); |
49 |
@@ -101,7 +120,7 @@ |
50 |
sub killall(); |
51 |
sub killJob($); |
52 |
sub killProcessGroup($$); |
53 |
-sub lg($); |
54 |
+#sub lg($); reetp - duplicate |
55 |
sub lg($); |
56 |
sub listArchives(); |
57 |
sub listArchivesRaw($); |
58 |
@@ -159,22 +178,72 @@ |
59 |
########## fin ajouts |
60 |
################################################################################### |
61 |
|
62 |
+################################################################################### |
63 |
+################ ajouts |
64 |
+ |
65 |
+my $configDB = esmith::ConfigDB->open or die "Error: Couldn't open config db."; |
66 |
+my $LocalIP = $configDB->get("LocalIP")->value; |
67 |
+my $DomainName = $configDB->get("DomainName")->value; |
68 |
+ |
69 |
+my $rpmlist = "/home/e-smith/db/affa-rpmlist"; # list of installed RPMs |
70 |
+ |
71 |
+my @services = ( 'crond', 'smbd', 'qmail', 'qpsmtpd', 'sqpsmtpd' ); |
72 |
+ |
73 |
+my $ServicesStopped = 0; |
74 |
+ |
75 |
+my $sshQuiet = "-q"; |
76 |
+ |
77 |
+my $ServerBasename = "AFFA.$SystemName.$DomainName-$LocalIP"; |
78 |
+ |
79 |
+############## fin ajouts |
80 |
+#################################################################################### |
81 |
+ |
82 |
my $allow_retry = 0; |
83 |
my $defaultEmail = 'admin'; |
84 |
|
85 |
my $SystemName = hostname(); |
86 |
( my $Domain = $SystemName ) =~ s/([^\.]*)\.//; |
87 |
+ |
88 |
#################################################################################### |
89 |
-################################################début modifs |
90 |
+############# début modifs |
91 |
#my $hostname=$1; |
92 |
my $hostname = $SystemName; |
93 |
-################################################# fin modifs |
94 |
+############# fin modifs |
95 |
#################################################################################### |
96 |
-my $affaTitle = "Affa version $VERSION on $SystemName"; |
97 |
-my $smbconf = '/etc/samba/smb.conf'; |
98 |
-my $SambaStartScript = '/etc/init.d/smb'; |
99 |
-my $NRPEStartScript = '/etc/init.d/nrpe'; |
100 |
-my $dedupBinary = '/usr/bin/freedup'; |
101 |
+ |
102 |
+my $affaTitle = "Affa version $VERSION on $SystemName"; |
103 |
+my $smbconf = '/etc/samba/smb.conf'; |
104 |
+ |
105 |
+############# |
106 |
+# reetp |
107 |
+# So we could change this to check the samba status as this is ONLY checking |
108 |
+# For the script existence OR /sbin/e-smith/service smb status | grep Active |
109 |
+ |
110 |
+my $systemD = new esmith::Service(); |
111 |
+ |
112 |
+# Service command << not required now |
113 |
+# $serviceCommand = '/sbin/e-smith/service' |
114 |
+ |
115 |
+my $SambaStartScript = '/usr/lib/systemd/system/smbd.service'; |
116 |
+#my $smbStatus = $configDB->get_prop( 'smb', 'status' ) || 'disabled'; |
117 |
+ |
118 |
+$systemD->{'serviceName'} = 'smbd'; |
119 |
+ |
120 |
+my $smbdStatus = ( $systemD->is_enabled() ) ? "enabled" : "disabled"; |
121 |
+ |
122 |
+# nrpe too |
123 |
+my $NRPEStartScript = '/usr/lib/systemd/system/nrpe.service'; |
124 |
+#my $nrpeStatus = $configDB->get_prop( 'nrpe', 'status' ) || 'disabled'; |
125 |
+ |
126 |
+$systemD->{'serviceName'} = 'nrpe'; |
127 |
+ |
128 |
+my $nrpeStatus = ( $systemD->is_enabled() ) ? "enabled" : "disabled"; |
129 |
+ |
130 |
+############# |
131 |
+ |
132 |
+# Test binary built in reetpTest repo |
133 |
+# No idea if it works on v10 |
134 |
+my $dedupBinary = '/usr/bin/freedup'; |
135 |
|
136 |
my $cfg; # ini file |
137 |
|
138 |
@@ -189,33 +258,14 @@ |
139 |
my $interactive = 0; |
140 |
my %autoMounted = (); |
141 |
my $interrupt = ''; |
142 |
-my $ExecCmdOutout = ''; |
143 |
+my $ExecCmdOut = ''; |
144 |
my @Messages = (); # List of all log messages |
145 |
my $logdir = '/var/log/affa'; # Logdir |
146 |
my $logfile = "$logdir/affa-GLOBAL-LOGFILE.log"; # Logfile |
147 |
+my $scriptdir = '/etc/affa/scripts'; |
148 |
my $lockdir = '/var/lock/affa'; # Process lock |
149 |
File::Path::mkpath( $lockdir, 0, 0700 ) if not -d $lockdir; |
150 |
-my $scriptdir = '/etc/affa/scripts'; |
151 |
- |
152 |
-################################################################################### |
153 |
-################ ajouts |
154 |
- |
155 |
-my $config = esmith::ConfigDB->open or die "Error: Couldn't open config db."; |
156 |
-my $LocalIP = $config->get("LocalIP")->value; |
157 |
-my $DomainName = $config->get("DomainName")->value; |
158 |
- |
159 |
-my $rpmlist = "/home/e-smith/db/affa-rpmlist"; # list of installed RPMs |
160 |
|
161 |
-my @services = ( 'crond', 'smb', 'qmail', 'qpsmtpd', 'sqpsmtpd' ); |
162 |
- |
163 |
-my $ServicesStopped = 0; |
164 |
- |
165 |
-my $sshQuiet = "-q"; |
166 |
- |
167 |
-my $ServerBasename = "AFFA.$SystemName.$DomainName-$LocalIP"; |
168 |
- |
169 |
-############## fin ajouts |
170 |
-#################################################################################### |
171 |
|
172 |
if ( not $ARGV[0] ) { |
173 |
showHelp(1); |
174 |
@@ -614,7 +664,7 @@ |
175 |
"$job{'RootDir'}/$jobname/scheduled.running/" |
176 |
); |
177 |
$status = ExecCmd( @cmd, 0 ); |
178 |
- $rsyncOutput = $ExecCmdOutout; |
179 |
+ $rsyncOutput = $ExecCmdOut; |
180 |
} |
181 |
else # Standard Linux |
182 |
{ |
183 |
@@ -664,7 +714,7 @@ |
184 |
|
185 |
lg("Running rsync..."); |
186 |
$status = ExecCmd( @cmd, 0 ); |
187 |
- $rsyncOutput = $ExecCmdOutout; |
188 |
+ $rsyncOutput = $ExecCmdOut; |
189 |
} |
190 |
|
191 |
# if nothing was transferred, scheduled.running does not exist |
192 |
@@ -1091,7 +1141,7 @@ |
193 |
my @cmd = ( 'find', '/etc/affa/', '-type', 'f', '-name', '"*.conf"' ); |
194 |
ExecCmd( @cmd, 0 ); |
195 |
my @ret = (); |
196 |
- my @list = split( /[\r\n]/, $ExecCmdOutout ); |
197 |
+ my @list = split( /[\r\n]/, $ExecCmdOut ); |
198 |
foreach my $s (@list) { |
199 |
my $c = Config::IniFiles->new( -file => $s ); |
200 |
if ( not $c ) { |
201 |
@@ -1305,8 +1355,8 @@ |
202 |
'echo OK' |
203 |
); |
204 |
ExecCmd( @cmd, 0 ); |
205 |
- chomp($ExecCmdOutout); |
206 |
- if ( $ExecCmdOutout ne "OK" ) { |
207 |
+ chomp($ExecCmdOut); |
208 |
+ if ( $ExecCmdOut ne "OK" ) { |
209 |
$status = -1; |
210 |
if ( !$silent ) { |
211 |
affaErrorExit( |
212 |
@@ -1809,8 +1859,8 @@ |
213 |
); |
214 |
my $stat = ExecCmd( @cmd, 0 ); |
215 |
$exectime = time() - $exectime; |
216 |
- $ExecCmdOutout =~ s/\n//; |
217 |
- $ExecCmdOutout =~ /([0-9]+) files of ([0-9]+) replaced by links.*?replaced files was ([0-9]+) bytes/; |
218 |
+ $ExecCmdOut =~ s/\n//; |
219 |
+ $ExecCmdOut =~ /([0-9]+) files of ([0-9]+) replaced by links.*?replaced files was ([0-9]+) bytes/; |
220 |
my $replacedFiles = defined $1 ? $1 : -1; |
221 |
my $totalFiles = defined $2 ? $2 : -1; |
222 |
my $savedBytes = defined $3 ? $3 : -1; |
223 |
@@ -1858,6 +1908,10 @@ |
224 |
print "# NRPE is not installed on the Affa server\n"; |
225 |
return -1; |
226 |
} |
227 |
+ if ( $nrpeStatus ne 'enabled' ) { |
228 |
+ lg("NRPE service is not running.") |
229 |
+ return; |
230 |
+ } |
231 |
open( FO, ">$af" ); |
232 |
print FO "command[check_affa]=sudo /sbin/affa --nrpe\n"; |
233 |
print FO "command[affa_jobsnrpe]=sudo /sbin/affa --_jobsnrpe\n"; |
234 |
@@ -1899,7 +1953,7 @@ |
235 |
shift(@csv); |
236 |
my $h; |
237 |
|
238 |
-##### début modifs |
239 |
+ ##### début modifs |
240 |
# ($h = sprintf "+-%076s-+\n", '-') =~ s/0/-/g; |
241 |
( $h = sprintf "+-%0110s-+\n", '-' ) =~ s/0/-/g; |
242 |
|
243 |
@@ -3222,8 +3276,8 @@ |
244 |
$job{'remoteUser'} . '@' . $job{'remoteHostName'}, 'echo OK' |
245 |
); |
246 |
ExecCmd( @cmd, 0 ); |
247 |
- chomp($ExecCmdOutout); |
248 |
- print( $ExecCmdOutout eq "OK" ? "ok\n" : "FAILED\n" ); |
249 |
+ chomp($ExecCmdOut); |
250 |
+ print( $ExecCmdOut eq "OK" ? "ok\n" : "FAILED\n" ); |
251 |
} |
252 |
} |
253 |
|
254 |
@@ -3565,6 +3619,7 @@ |
255 |
lg($txt); |
256 |
print "$txt\n"; |
257 |
} |
258 |
+ |
259 |
#################################################################################### |
260 |
#### début des modifs: copié à partir de Affa V2 et ajouté "$jobname" à mailTestWatchdogRemote(); |
261 |
if ( $job{'Watchdog'} eq 'yes' and $job{'remoteHostName'} ne 'localhost' ) { |
262 |
@@ -3580,58 +3635,63 @@ |
263 |
|
264 |
sub setupSamba() { |
265 |
lg("Configuring Samba"); |
266 |
- if ( not -f $SambaStartScript ) { |
267 |
- lg("Samba service is not installed or not properly configured."); |
268 |
- return; |
269 |
+ if ( $smbdStatus ne 'enabled' ) lg("Samba service is not installed or not properly configured."); |
270 |
+ return; |
271 |
+} |
272 |
+my %inc; |
273 |
+foreach my $jobname ( $cfg->Sections() ) { |
274 |
+ next if $jobname eq 'GlobalAffaConfig'; |
275 |
+ my %job = getJobConfig($jobname); |
276 |
+ if ( not $job{'_SambaValidUser'} and $job{'SambaShare'} eq 'yes' ) { |
277 |
+ lg("Job $jobname: No Valid Users defined. Samba has been access disabled."); |
278 |
} |
279 |
- my %inc; |
280 |
- foreach my $jobname ( $cfg->Sections() ) { |
281 |
- next if $jobname eq 'GlobalAffaConfig'; |
282 |
- my %job = getJobConfig($jobname); |
283 |
- if ( not $job{'_SambaValidUser'} and $job{'SambaShare'} eq 'yes' ) { |
284 |
- lg("Job $jobname: No Valid Users defined. Samba has been access disabled."); |
285 |
- } |
286 |
- my $affasmb = "/etc/samba/Affa-Job-$jobname.conf"; |
287 |
- if ( $job{'SambaShare'} eq 'yes' and $job{'_SambaValidUser'} ) { |
288 |
- open( FD, ">$affasmb" ) or affaErrorExit("Could not create $affasmb"); |
289 |
- print FD "[$jobname]\n"; |
290 |
- print FD "path = $job{'RootDir'}/$jobname\n"; |
291 |
- print FD "comment = Affa archive: $job{'Description'}\n"; |
292 |
- print FD "valid users = $job{'_SambaValidUser'}\n"; |
293 |
- print FD "force user = root\n"; |
294 |
- print FD "read only = yes\n"; |
295 |
- print FD "writable = no\n"; |
296 |
- print FD "veto files = /.$jobname-setup.ini/,/.doneDates/,/.AFFA3-REPORT/,/.AFFA-REPORT/.AFFA-TRASH/\n\n"; |
297 |
- close(FD); |
298 |
- $inc{"include = $affasmb"} = 1; |
299 |
- } |
300 |
- else { |
301 |
- unlink($affasmb); |
302 |
- } |
303 |
+ my $affasmb = "/etc/samba/Affa-Job-$jobname.conf"; |
304 |
+ if ( $job{'SambaShare'} eq 'yes' and $job{'_SambaValidUser'} ) { |
305 |
+ open( FD, ">$affasmb" ) or affaErrorExit("Could not create $affasmb"); |
306 |
+ print FD "[$jobname]\n"; |
307 |
+ print FD "path = $job{'RootDir'}/$jobname\n"; |
308 |
+ print FD "comment = Affa archive: $job{'Description'}\n"; |
309 |
+ print FD "valid users = $job{'_SambaValidUser'}\n"; |
310 |
+ print FD "force user = root\n"; |
311 |
+ print FD "read only = yes\n"; |
312 |
+ print FD "writable = no\n"; |
313 |
+ print FD "veto files = /.$jobname-setup.ini/,/.doneDates/,/.AFFA3-REPORT/,/.AFFA-REPORT/.AFFA-TRASH/\n\n"; |
314 |
+ close(FD); |
315 |
+ $inc{"include = $affasmb"} = 1; |
316 |
+ } |
317 |
+ else { |
318 |
+ unlink($affasmb); |
319 |
} |
320 |
+} |
321 |
|
322 |
- open( FD, "<$smbconf" ) or affaErrorExit("Could not open $smbconf"); |
323 |
- open( FW, ">$smbconf.$$" ) or affaErrorExit("Could not create $smbconf.$$"); |
324 |
- while (<FD>) { |
325 |
- $_ = trim($_); |
326 |
- if ( $_ =~ /include = (\/etc\/samba\/Affa-Job.*conf)/ and not $inc{$_} ) { |
327 |
- unlink $1; |
328 |
- } |
329 |
- print FW "$_\n" if not $_ =~ /(include = \/etc\/samba\/Affa-Job|# Affa archives. Updated on)/; |
330 |
+open( FD, "<$smbconf" ) or affaErrorExit("Could not open $smbconf"); |
331 |
+open( FW, ">$smbconf.$$" ) or affaErrorExit("Could not create $smbconf.$$"); |
332 |
+while (<FD>) { |
333 |
+ $_ = trim($_); |
334 |
+ if ( $_ =~ /include = (\/etc\/samba\/Affa-Job.*conf)/ and not $inc{$_} ) { |
335 |
+ unlink $1; |
336 |
+ } |
337 |
+ print FW "$_\n" if not $_ =~ /(include = \/etc\/samba\/Affa-Job|# Affa archives. Updated on)/; |
338 |
|
339 |
- # ligne d'origine - Bug 9298 - if( $_ =~ /^\[global\]$/i ) { |
340 |
- if ( $_ =~ /^#\[Affa-jobs\]$/i ) { |
341 |
- printf FW "# Affa archives. Updated on " |
342 |
- . formatHTime( Date::Format::time2str( "%Y%m%d%H%M", time() ) ) . "\n"; |
343 |
- print FW join( "\n", sort keys %inc ) . "\n"; |
344 |
- } |
345 |
+ # ligne d'origine - Bug 9298 - if( $_ =~ /^\[global\]$/i ) { |
346 |
+ if ( $_ =~ /^#\[Affa-jobs\]$/i ) { |
347 |
+ printf FW "# Affa archives. Updated on " . formatHTime( Date::Format::time2str( "%Y%m%d%H%M", time() ) ) . "\n"; |
348 |
+ print FW join( "\n", sort keys %inc ) . "\n"; |
349 |
} |
350 |
- close(FD); |
351 |
- close(FW); |
352 |
+} |
353 |
+close(FD); |
354 |
+close(FW); |
355 |
+ |
356 |
+rename( "$smbconf.$$", "$smbconf" ) or affaErrorExit("Moving $smbconf.$$ to $smbconf failed"); |
357 |
+#my @cmd = ( $servicecommand, 'smb', 'reload' ); # reetp changed to restart |
358 |
+#ExecCmd( @cmd, 0 ); # Reload Samba config |
359 |
+ |
360 |
+$systemD->{'serviceName'} = 'smbd'; |
361 |
+ |
362 |
+my $smbdStatus = ( $systemD->reload() ); # reetp - failure?? |
363 |
+ |
364 |
+print "Status $smbdStatus\n"; |
365 |
|
366 |
- rename( "$smbconf.$$", "$smbconf" ) or affaErrorExit("Moving $smbconf.$$ to $smbconf failed"); |
367 |
- my @cmd = ( $SambaStartScript, 'reload' ); |
368 |
- ExecCmd( @cmd, 0 ); # Reload Samba config |
369 |
} |
370 |
|
371 |
sub sendErrorMesssage() { |
372 |
@@ -3937,7 +3997,7 @@ |
373 |
|
374 |
################################################################################################################################################# |
375 |
###################################################### début modifs ajouté comme dans Affa2 |
376 |
- startServices() if $ServicesStopped; |
377 |
+ startServices() if $ServicesStopped; # reetp - note to self |
378 |
###################################################### fin modifs |
379 |
#################################################################################################################################################### |
380 |
|
381 |
@@ -4009,13 +4069,13 @@ |
382 |
$forcelog = 1 if $job{'Debug'}; |
383 |
die "Fork failed: $!\n" unless defined( my $pid = open( RCHILD, "-|" ) ); |
384 |
if ($pid) { |
385 |
- $ExecCmdOutout = ''; |
386 |
+ $ExecCmdOut = ''; |
387 |
while (<RCHILD>) { |
388 |
chomp($_); |
389 |
next if $_ eq ''; |
390 |
dbg("Exec Out: $pipestatus") if $forcelog and $pipestatus; # one step offset |
391 |
s/\e\[[0-9\;]+[A-Za-z]//g; # remove ANSI escape sequences |
392 |
- $ExecCmdOutout .= "$_\n"; |
393 |
+ $ExecCmdOut .= "$_\n"; |
394 |
$pipestatus = $_; |
395 |
} |
396 |
close(RCHILD); |
397 |
@@ -4024,7 +4084,7 @@ |
398 |
dbg("Exec Cmd: @cmd"); |
399 |
exec("@cmd 2>&1; echo \${PIPESTATUS}") or die "exec failed: $!\n"; |
400 |
} |
401 |
- $ExecCmdOutout =~ s/$pipestatus\n$//; |
402 |
+ $ExecCmdOut =~ s/$pipestatus\n$//; |
403 |
$pipestatus = $? if not $pipestatus; |
404 |
dbg("Exec Out: exitstatus=$pipestatus") if $forcelog; |
405 |
return $pipestatus; |
406 |
@@ -4128,7 +4188,7 @@ |
407 |
$SIG{'INT'} = sub { }; |
408 |
$interactive = 1; |
409 |
my @cmd; |
410 |
- my $bootstrap = $config->get_prop( "bootstrap-console", "Run" ); |
411 |
+ my $bootstrap = $configDB->get_prop( "bootstrap-console", "Run" ); |
412 |
my $jobname = $ARGV[0] || ''; |
413 |
my $archive = $ARGV[1] || 'scheduled.0'; |
414 |
#################################################################################### |
415 |
@@ -4235,11 +4295,12 @@ |
416 |
@cmd = ( "/sbin/e-smith/signal-event", "pre-restore" ); |
417 |
ExecCmd( @cmd, 0 ); |
418 |
|
419 |
- $config = esmith::ConfigDB->close; |
420 |
+ $configDB = esmith::ConfigDB->close; |
421 |
|
422 |
##### ligne d'origine AffaV2: runRiseRsync("$job{'RootDir'}/$jobname/$archive/", "/"); |
423 |
runRiseRsync( $jobname, "$job{'RootDir'}/$jobname/$archive/", "/" ); |
424 |
- $config = esmith::ConfigDB->open or die "Error: Couldn't open config db."; |
425 |
+ |
426 |
+ $configDB = esmith::ConfigDB->open or die "Error: Couldn't open config db."; |
427 |
|
428 |
imapIndexFilesDelete(); |
429 |
|
430 |
@@ -4254,13 +4315,13 @@ |
431 |
my $srcconfigPath = "/var/affa/$ServerBasename/scheduled.0/home/e-smith/db/configuration"; |
432 |
my $srcconfig = esmith::ConfigDB->open_ro($srcconfigPath) |
433 |
or affaErrorExit("Couldn't open source config db $srcconfigPath"); |
434 |
- $config->set_prop( "EthernetDriver1", "type", $srcconfig->get("EthernetDriver1")->value ); |
435 |
- $config->set_prop( "EthernetDriver2", "type", $srcconfig->get("EthernetDriver2")->value ); |
436 |
- $config->set_prop( "InternalInterface", "Driver", $srcconfig->get_prop( "InternalInterface", "Driver" ) ); |
437 |
- $config->set_prop( "InternalInterface", "Name", $srcconfig->get_prop( "InternalInterface", "Name" ) ); |
438 |
- $config->set_prop( "InternalInterface", "NICBondingOptions", |
439 |
+ $configDB->set_prop( "EthernetDriver1", "type", $srcconfig->get("EthernetDriver1")->value ); |
440 |
+ $configDB->set_prop( "EthernetDriver2", "type", $srcconfig->get("EthernetDriver2")->value ); |
441 |
+ $configDB->set_prop( "InternalInterface", "Driver", $srcconfig->get_prop( "InternalInterface", "Driver" ) ); |
442 |
+ $configDB->set_prop( "InternalInterface", "Name", $srcconfig->get_prop( "InternalInterface", "Name" ) ); |
443 |
+ $configDB->set_prop( "InternalInterface", "NICBondingOptions", |
444 |
$srcconfig->get_prop( "InternalInterface", "NICBondingOptions" ) ); |
445 |
- $config->set_prop( "InternalInterface", "NICBonding", |
446 |
+ $configDB->set_prop( "InternalInterface", "NICBonding", |
447 |
$srcconfig->get_prop( "InternalInterface", "NICBonding" ) || 'disabled' ); |
448 |
|
449 |
print "Please make sure that the server '" . $job{'remoteHostName'} . "' is not connected to your network.\n"; |
450 |
@@ -4313,11 +4374,11 @@ |
451 |
sub runRiseRsync($$$) { |
452 |
( my $jobname, my $archive, my $dest ) = @_; |
453 |
|
454 |
-##### ligne d'origine AffaV2: (my $archive,my $dest)=@_; |
455 |
+#### ligne d'origine AffaV2: (my $archive,my $dest)=@_; |
456 |
|
457 |
my $b = new esmith::Backup or die "Error: Couldn't create Backup object\n"; |
458 |
|
459 |
-#### ligne d'origine AffaV2: my @SourceDirs = $opts{'all'} ? getSourceDirs() : $b->restore_list; |
460 |
+#### ligne d'origine AffaV2: my @SourceDirs = $opts{'all'} ? getSourceDirs() : $b->restore_list; |
461 |
my @SourceDirs = $opts{'all'} ? getSourceDirs($jobname) : $b->restore_list; |
462 |
|
463 |
if ( $jobname eq 'undo-rise' ) { |
464 |
@@ -4341,8 +4402,8 @@ |
465 |
my $status = ExecCmd( @cmd, 0 ); |
466 |
if ( $status == 0 or $status == 23 or $status == 24 ) { |
467 |
|
468 |
- # $Affa::lib::ExecCmdOutout =~ /(Total file size: [0-9]* bytes)/gm; |
469 |
- $ExecCmdOutout =~ /(Total file size: [0-9]* bytes)/gm; |
470 |
+ # $Affa::lib::ExecCmdOut =~ /(Total file size: [0-9]* bytes)/gm; |
471 |
+ $ExecCmdOut =~ /(Total file size: [0-9]* bytes)/gm; |
472 |
|
473 |
# print "OK. $1\n"; ##### Bug 9139: valeur de $1 non définie. |
474 |
print "OK. \n"; |
475 |
@@ -4355,26 +4416,42 @@ |
476 |
|
477 |
sub stopServices() { |
478 |
lg("Stopping services..."); |
479 |
- my @cmd; |
480 |
+ |
481 |
+ # my @cmd; |
482 |
+ |
483 |
foreach my $svc (@services) { |
484 |
- @cmd = ( '/sbin/e-smith/service', $svc, 'stop' ); |
485 |
- ExecCmd( @cmd, 0 ); |
486 |
- |
487 |
- # print $Affa::lib::ExecCmdOutout; |
488 |
- print $ExecCmdOutout; |
489 |
+ |
490 |
+ #reetp stop services |
491 |
+ $systemD->{'serviceName'} = $svc; |
492 |
+ my $Status = ( $systemD->stop() ); |
493 |
+ |
494 |
+ # @cmd = ( $serviceCommand, $svc, 'stop' ); |
495 |
+ # ExecCmd( @cmd, 0 ); |
496 |
+ |
497 |
+ # print $Affa::lib::ExecCmdOut; |
498 |
+ # print $ExecCmdOut; |
499 |
+ print "Start $svc $Status\n"; #reetp - status? |
500 |
} |
501 |
$ServicesStopped = 1; |
502 |
} |
503 |
|
504 |
sub startServices() { |
505 |
lg("Starting services..."); |
506 |
- my @cmd; |
507 |
+ |
508 |
+ #my @cmd; |
509 |
+ |
510 |
foreach my $svc (@services) { |
511 |
- @cmd = ( '/sbin/e-smith/service', $svc, 'start' ); |
512 |
- ExecCmd( @cmd, 0 ); |
513 |
- |
514 |
- # print $Affa::lib::ExecCmdOutout; |
515 |
- print $ExecCmdOutout; |
516 |
+ |
517 |
+ |
518 |
+ $systemD->{'serviceName'} = $svc; |
519 |
+ my $Status = ( $systemD->start() ); |
520 |
+ |
521 |
+ # @cmd = ( $serviceCommand, $svc, 'start' ); |
522 |
+ # ExecCmd( @cmd, 0 ); |
523 |
+ |
524 |
+ # print $Affa::lib::ExecCmdOut; |
525 |
+ # print $ExecCmdOut; |
526 |
+ print "Stop $svc $Status\n"; #reetp - status? |
527 |
} |
528 |
$ServicesStopped = 0; |
529 |
} |