从线程表里认出卡住的
真机上 ps -L -o stat,comm 打出进程里每条线程的状态和名字。要在脚本里挑出「还活着的工人」,先在这里练:
lines = ["Ssl 服务", "Ssl 服务-心跳", "Rsl 服务-乙", "Ssl 服务-丁"]
workers = []
for l in lines:
stat, name = l.split()
if name.startswith("服务-") and name != "服务-心跳":
workers.append(name + ":" + ("转" if stat.startswith("R") else "等"))
print(",".join(workers))
全部评论