25 lines
779 B
PowerShell
25 lines
779 B
PowerShell
param(
|
|
[string]$NasUser = "y2keui",
|
|
[string]$NasHost = "comtropy.synology.me",
|
|
[int]$NasPort = 50022,
|
|
[string]$RemoteDir = "/volume1/docker/telegram-codex-bot",
|
|
[string]$SshKeyPath = "$env:USERPROFILE\.ssh\nas_codex_ed25519"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$remote = "${NasUser}@${NasHost}"
|
|
$sshAuthArgs = @()
|
|
if ($SshKeyPath -and (Test-Path $SshKeyPath)) {
|
|
$sshAuthArgs = @("-i", $SshKeyPath, "-o", "IdentitiesOnly=yes")
|
|
}
|
|
$remoteCommand = @"
|
|
export PATH=/usr/local/bin:/var/packages/ContainerManager/target/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
|
|
cd '$RemoteDir'
|
|
sudo /usr/local/bin/docker-compose ps
|
|
echo '--- logs ---'
|
|
sudo /usr/local/bin/docker-compose logs --tail=160 telegram-codex-bot
|
|
"@
|
|
|
|
ssh @sshAuthArgs -tt -p $NasPort $remote $remoteCommand
|