1 |
jcrisp |
1.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-09-22 16:40:29.475850541 +0200 |
3 |
|
|
+++ smeserver-affa-3.3.1/root/sbin/affa 2021-09-22 16:41:13.782580213 +0200 |
4 |
|
|
@@ -580,8 +580,7 @@ |
5 |
|
|
my @cmd = ( $1, '--run', $jobname, 'yearly' ); |
6 |
|
|
ExecCmd( @cmd, 1 ) if ( $job{'_doneDates'}->val( 'doneDates', 'yearly' ) ne $thisYear and $job{'yearlyKeep'} > 0 ); |
7 |
|
|
$cmd[3] = 'monthly'; |
8 |
|
|
- ExecCmd( @cmd, 1 ) |
9 |
|
|
- if ( $job{'_doneDates'}->val( 'doneDates', 'monthly' ) ne $thisMonth and $job{'monthlyKeep'} > 0 ); |
10 |
|
|
+ ExecCmd( @cmd, 1 ) if ( $job{'_doneDates'}->val( 'doneDates', 'monthly' ) ne $thisMonth and $job{'monthlyKeep'} > 0 ); |
11 |
|
|
$cmd[3] = 'weekly'; |
12 |
|
|
ExecCmd( @cmd, 1 ) if ( $job{'_doneDates'}->val( 'doneDates', 'weekly' ) ne $thisWeek and $job{'weeklyKeep'} > 0 ); |
13 |
|
|
$cmd[3] = 'daily'; |
14 |
|
|
@@ -688,8 +687,7 @@ |
15 |
|
|
$job{'rsyncCompress'} eq 'yes' ? "--compress" : "", |
16 |
|
|
"--numeric-ids", |
17 |
|
|
"--rsync-path=\"$job{'_rsyncRemote'}\"", |
18 |
|
|
- "--rsh=\"$job{'localSSHBinary'} $job{'_sshOpts'}\"", |
19 |
|
|
- ( $linkDest ? "--link-dest='$job{'RootDir'}/$jobname/$linkDest'" : '' ), |
20 |
|
|
+ "--rsh=\"$job{'localSSHBinary'} $job{'_sshOpts'}\"", ( $linkDest ? "--link-dest='$job{'RootDir'}/$jobname/$linkDest'" : '' ), |
21 |
|
|
$include, |
22 |
|
|
$exclude, |
23 |
|
|
$job{'rsyncOptions'}, |
24 |
|
|
@@ -1007,9 +1005,7 @@ |
25 |
|
|
# get Done Dates |
26 |
|
|
if ($jobname) { |
27 |
|
|
# reetp add -i id_rsa_affa here |
28 |
|
|
- $job{'_sshOpts'} = |
29 |
|
|
- "-p $job{'sshPort'} -i '/root/.ssh/id_rsa_affa' -o CheckHostIP=no -o StrictHostKeyChecking=no -o HostKeyAlias=$jobname -o UserKnownHostsFile=/root/.ssh/knownhosts-$jobname" |
30 |
|
|
- . ( $job{'Debug'} ne 'yes' ? ' -q' : '' ); |
31 |
|
|
+ $job{'_sshOpts'} = "-p $job{'sshPort'} -i '/root/.ssh/id_rsa_affa' -o CheckHostIP=no -o StrictHostKeyChecking=no -o HostKeyAlias=$jobname -o UserKnownHostsFile=/root/.ssh/knownhosts-$jobname" . ( $job{'Debug'} ne 'yes' ? ' -q' : '' ); |
32 |
|
|
$job{'_lockfile'} = "$lockdir/$jobname"; |
33 |
|
|
} |
34 |
|
|
return %job; |
35 |
|
|
@@ -1345,10 +1341,7 @@ |
36 |
|
|
} |
37 |
|
|
else { |
38 |
|
|
lg( "Checking SSH connection to " . $job{'remoteUser'} . '@' . $job{'remoteHostName'} ); |
39 |
|
|
- @cmd = ( |
40 |
|
|
- '/usr/bin/ssh', '-o', "ConnectTimeout=$job{'ConnectionCheckTimeout'}", |
41 |
|
|
- '-o', 'PasswordAuthentication=no', $job{'_sshOpts'}, $job{'remoteUser'} . '@' . $job{'remoteHostName'}, |
42 |
|
|
- 'echo OK' |
43 |
|
|
+ @cmd = ( '/usr/bin/ssh', '-o', "ConnectTimeout=$job{'ConnectionCheckTimeout'}", '-o', 'PasswordAuthentication=no', $job{'_sshOpts'}, $job{'remoteUser'} . '@' . $job{'remoteHostName'}, 'echo OK' |
44 |
|
|
); |
45 |
|
|
ExecCmd( @cmd, 0 ); |
46 |
|
|
chomp($ExecCmdOut); |
47 |
|
|
@@ -1380,9 +1373,7 @@ |
48 |
|
|
|
49 |
|
|
#### ligne suivante: rajouté $jobname |
50 |
|
|
remoteCopy( $jobname, "/sbin/e-smith/affa-rpmlist.sh", "/sbin/e-smith/affa-rpmlist.sh" ); |
51 |
|
|
- @cmd = ( |
52 |
|
|
- '/usr/bin/ssh', '-o', "HostKeyAlias=$jobname", '-p', $job{'sshPort'}, $sshQuiet, $job{'remoteHostName'}, |
53 |
|
|
- "'/sbin/e-smith/affa-rpmlist.sh>$rpmlist'" |
54 |
|
|
+ @cmd = ( '/usr/bin/ssh', '-p', $job{'sshPort'}, '-i', '/root/.ssh/id_rsa_affa', '-o', "HostKeyAlias=$jobname", $sshQuiet, $job{'remoteHostName'}, "'/sbin/e-smith/affa-rpmlist.sh>$rpmlist'" |
55 |
|
|
); |
56 |
|
|
} |
57 |
|
|
not ExecCmd( @cmd, 0 ) or affaErrorExit("writing list of installed RPMs failed."); |
58 |
|
|
@@ -1691,9 +1682,7 @@ |
59 |
|
|
close(WDS); |
60 |
|
|
close(WD); |
61 |
|
|
chmod( 0700, "/tmp/$$.$WDName" ); |
62 |
|
|
- my @cmd = ( |
63 |
|
|
- '/usr/bin/ssh', '-o', "HostKeyAlias=$jobname", '-p', $job{'sshPort'}, $job{'remoteHostName'}, "/bin/rm", "-f", |
64 |
|
|
- "/etc/cron.hourly/$WDName-reminder" |
65 |
|
|
+ my @cmd = ( '/usr/bin/ssh', '-p', $job{'sshPort'}, '-i', '/root/.ssh/id_rsa_affa', '-o', "HostKeyAlias=$jobname", $job{'remoteHostName'}, "/bin/rm", "-f", "/etc/cron.hourly/$WDName-reminder" |
66 |
|
|
); |
67 |
|
|
not ExecCmd( @cmd, 0 ) or affaErrorExit("Couldn't delete /etc/cron.hourly/$WDName-reminder on remote host."); |
68 |
|
|
##### ligne suivante: ajouté $jobname |
69 |
|
|
@@ -1726,9 +1715,7 @@ |
70 |
|
|
|
71 |
|
|
#### ligne suivante: ajouté $jobname |
72 |
|
|
remoteCopy( $jobname, "/usr/lib/affa/$WDName", "/tmp/" ); |
73 |
|
|
- my @cmd = ( |
74 |
|
|
- '/usr/bin/ssh', '-p', $job{'sshPort'}, '-o', "HostKeyAlias=$jobname", $sshQuiet, $job{'remoteHostName'}, |
75 |
|
|
- "/tmp/$WDName" |
76 |
|
|
+ my @cmd = ( '/usr/bin/ssh', '-p', $job{'sshPort'}, '-i', '/root/.ssh/id_rsa_affa', '-o', "HostKeyAlias=$jobname", $sshQuiet, $job{'remoteHostName'}, "/tmp/$WDName" |
77 |
|
|
); |
78 |
|
|
not ExecCmd( @cmd, 0 ) or affaErrorExit("Couldn't run /usr/lib/affa/$WDName on remote host."); |
79 |
|
|
} |
80 |
|
|
@@ -3104,9 +3091,7 @@ |
81 |
|
|
"--partial", |
82 |
|
|
$job{'rsync--inplace'} ne 'no' ? "--inplace" : "", |
83 |
|
|
"--numeric-ids", |
84 |
|
|
- "--rsh=\"$job{'localSSHBinary'} $job{'_sshOpts'}\"", |
85 |
|
|
- ( -d $src ? "$src/" : "$src" ), |
86 |
|
|
- $job{'remoteHostName'} eq 'localhost' ? "/$k" : $job{'remoteUser'} . '@' . $job{'remoteHostName'} . ":/$k" |
87 |
|
|
+ "--rsh=\"$job{'localSSHBinary'} $job{'_sshOpts'}\"", ( -d $src ? "$src/" : "$src" ), $job{'remoteHostName'} eq 'localhost' ? "/$k" : $job{'remoteUser'} . '@' . $job{'remoteHostName'} . ":/$k" |
88 |
|
|
); |
89 |
|
|
|
90 |
|
|
#################################################################################### |
91 |
|
|
@@ -3255,27 +3240,20 @@ |
92 |
|
|
printf "%-16s : ", $jb; |
93 |
|
|
if ( $job{'_rsyncd'} ) { |
94 |
|
|
print "Rsyncd connection "; |
95 |
|
|
- @cmd = ( |
96 |
|
|
- $job{'_rsyncLocal'}, '-dq', |
97 |
|
|
- ( $job{'rsyncdUser'} ? $job{'rsyncdUser'} . '@' : '' ) |
98 |
|
|
- . $job{'remoteHostName'} . "::'" |
99 |
|
|
- . $job{'rsyncdModule'} . "'" |
100 |
|
|
+ @cmd = ( $job{'_rsyncLocal'}, '-dq', ( $job{'rsyncdUser'} ? $job{'rsyncdUser'} . '@' : '' ) . $job{'remoteHostName'} . "::'" . $job{'rsyncdModule'} . "'" |
101 |
|
|
); |
102 |
|
|
print( ( ( ExecCmd( @cmd, 0 ) == 0 ) ? "ok" : "FAILED" ) . ". " ); |
103 |
|
|
} |
104 |
|
|
- print "SSH connection "; |
105 |
|
|
- @cmd = ( |
106 |
|
|
- '/usr/bin/ssh', '-p', |
107 |
|
|
- $job{'sshPort'}, '-o', |
108 |
|
|
- "HostKeyAlias=$jb", '-o', |
109 |
|
|
- 'StrictHostKeyChecking=yes', '-o', |
110 |
|
|
- "ConnectTimeout=$job{'ConnectionCheckTimeout'}", '-o', |
111 |
|
|
- 'PasswordAuthentication=no', $job{'_sshOpts'}, |
112 |
|
|
- $job{'remoteUser'} . '@' . $job{'remoteHostName'}, 'echo OK' |
113 |
|
|
- ); |
114 |
|
|
- ExecCmd( @cmd, 0 ); |
115 |
|
|
- chomp($ExecCmdOut); |
116 |
|
|
- print( $ExecCmdOut eq "OK" ? "ok\n" : "FAILED\n" ); |
117 |
|
|
+ if ($jb ne 'localhost') { |
118 |
|
|
+ print "SSH connection "; |
119 |
|
|
+ @cmd = ( '/usr/bin/ssh', '-p', $job{'sshPort'}, '-i', '/root/.ssh/id_rsa_affa', '-o', "HostKeyAlias=$jb", '-o', 'StrictHostKeyChecking=yes', '-o', "ConnectTimeout=$job{'ConnectionCheckTimeout'}", '-o', 'PasswordAuthentication=no', $job{'_sshOpts'}, $job{'remoteUser'} . '@' . $job{'remoteHostName'}, 'echo OK' |
120 |
|
|
+ ); |
121 |
|
|
+ ExecCmd( @cmd, 0 ); |
122 |
|
|
+ chomp($ExecCmdOut); |
123 |
|
|
+ print( $ExecCmdOut eq "OK" ? "ok\n" : "FAILED\n" ); |
124 |
|
|
+ } else { |
125 |
|
|
+ print "Not tested\n"; |
126 |
|
|
+ } |
127 |
|
|
} |
128 |
|
|
} |
129 |
|
|
|