新的信息

This commit is contained in:
dongchangxi committed 2024-09-02 16:52:37 +08:00
1 parent c66fc76e10
commit 345790cb05
51 files changed
+5187 -61

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import paramiko
try:
# 创建SSH对象
ssh = paramiko.SSHClient()
# 允许连接不在known_hosts文件中的主机
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print('start connect')
# 连接服务器
ssh.connect('connect.bjc1.seetacloud.com', username='root', password='QoQA8q3Ds2VB', port=33733)
print('connect success')
# 使用nohup执行命令,并将输出重定向到文件
command = 'nohup seg_python /data/code/optimize_model_xj/optimize_model.py -pid 189813 > output.log 2>&1 &'
stdin, stdout, stderr = ssh.exec_command(command)
# 打印命令是否启动成功
print("Command executed")
finally:
# 确保连接被关闭
if ssh:
ssh.close()