Smail/test/tools/deploy_run.py
smail bf1e69f480
Some checks are pending
Security Checks / security (push) Waiting to run
修复生产审查凭据泄露风险并增加持久投递队列
2026-09-17 10:17:09 +08:00

15 lines
730 B
Python

import paramiko, time
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.RejectPolicy())
from remote_ssh import connect_remote
connect_remote(ssh)
s_in, s_out, s_err = ssh.exec_command("chmod +x /opt/smail/smail_new && pkill -9 -f smail || true")
s_out.channel.recv_exit_status()
time.sleep(1)
s_in, s_out, s_err = ssh.exec_command("cp /opt/smail/smail /opt/smail/smail.bak_0914 && cp /opt/smail/smail_new /opt/smail/smail && chmod +x /opt/smail/smail")
s_out.channel.recv_exit_status()
ssh.exec_command("cd /opt/smail && nohup ./run.sh > /dev/null 2>&1 &")
time.sleep(3)
s_in, s_out, s_err = ssh.exec_command("ps aux | grep smail && tail -n 20 /opt/smail/log/stdout.log")
print(s_out.read().decode())
ssh.close()