24 lines
688 B
Python
24 lines
688 B
Python
import paramiko
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
def run(cmd):
|
|
stdin, stdout, stderr = c.exec_command(cmd)
|
|
return stdout.read().decode().strip(), stderr.read().decode().strip()
|
|
|
|
print("Current settings.yml:")
|
|
out, _ = run("cat /mnt/swarm_shared/legacy_volumes/peanut/settings.yml")
|
|
print(out)
|
|
|
|
print("\nRestarting PeaNUT service...")
|
|
out, err = run("echo 'Katzir476!' | sudo -S docker service update --force peanut_peanut")
|
|
print(out)
|
|
if err: print(err)
|
|
|
|
c.close()
|
|
|