15 lines
730 B
Python
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() |