different:powershell_ssh_scp
Различия
Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слеваПредыдущая версияСледующая версия | Предыдущая версия | ||
different:powershell_ssh_scp [2024/08/19 14:36] – root | different:powershell_ssh_scp [2024/12/21 19:00] (текущий) – внешнее изменение 127.0.0.1 | ||
---|---|---|---|
Строка 50: | Строка 50: | ||
$sshCommand = "rm system backup " + $backupName +" | $sshCommand = "rm system backup " + $backupName +" | ||
Write-Host($sshCommand) | Write-Host($sshCommand) | ||
- | $sshSession = New-SSHSession -ComputerName $server.ip -Credential $cred -AcceptKey | + | $sshSession = New-SSHSession -ComputerName $server.ip -Credential $cred -AcceptKey |
$result = Invoke-SSHCommand -Command $sshCommand -SSHSession $sshSession | $result = Invoke-SSHCommand -Command $sshCommand -SSHSession $sshSession | ||
if ($result.ExitStatus -eq 0) { | if ($result.ExitStatus -eq 0) { | ||
Строка 90: | Строка 90: | ||
$backup_name_pattern = $server.name+ " | $backup_name_pattern = $server.name+ " | ||
Write-Host($server.name, | Write-Host($server.name, | ||
- | $sshCommand | + | $sshCommands = @() |
- | | + | $sshCommands += "set HA node -haSync DISABLED -haProp DISABLED" |
+ | $sshCommands += "save ns config" | ||
+ | $sshCommands += " | ||
+ | | ||
+ | | ||
$sshSession = New-SSHSession -ComputerName $server.ip -Credential $cred -AcceptKey | $sshSession = New-SSHSession -ComputerName $server.ip -Credential $cred -AcceptKey | ||
- | $result = Invoke-SSHCommand -Command $sshCommand | + | |
+ | Invoke-SSHCommand -Command $sshCommands[1] -SSHSession $sshSession | ||
+ | | ||
if ($result.ExitStatus -eq 0) { | if ($result.ExitStatus -eq 0) { | ||
$result = get_backup -server $server -backupName $backup_name_pattern -destinationPath $backupStorePath -erase $erase | $result = get_backup -server $server -backupName $backup_name_pattern -destinationPath $backupStorePath -erase $erase | ||
Строка 100: | Строка 106: | ||
Write-Host($result.Host, | Write-Host($result.Host, | ||
} | } | ||
+ | Invoke-SSHCommand -Command $sshCommands[3] -SSHSession $sshSession - | ||
+ | Invoke-SSHCommand -Command $sshCommands[4] -SSHSession $sshSession | ||
Remove-SSHSession -SessionId $sshSession.SessionId | Remove-SSHSession -SessionId $sshSession.SessionId | ||
} | } |
different/powershell_ssh_scp.1724067379.txt.gz · Последнее изменение: 2024/12/21 19:00 (внешнее изменение)