watchdog v6: 自愈前先抓 jstack 现场,保存到 logs/jstack_dump/ 下次推送线程死锁根因可追溯
This commit is contained in:
1 parent
e8fab900fa
commit
689303f5d7
3 files changed
+49
-17
No files matched your search
+3
-2
@@ -3,9 +3,10 @@ host, user, password, cmd = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
try:
|
||||
ssh.connect(host, username=user, password=password, timeout=10)
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
ssh.connect(host, username=user, password=password, timeout=30)
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd, timeout=30)
|
||||
sys.stdout.write(stdout.read().decode("utf-8", errors="replace"))
|
||||
sys.stderr.write(stderr.read().decode("utf-8", errors="replace"))
|
||||
ssh.close()
|
||||
except Exception as e:
|
||||
print(f"SSH_ERROR: {e}", file=sys.stderr)
|
||||
|
||||
Reference in new issue
Block a user