我想使用 python 重新启动远程 linux(Redhat) 机器,但有时远程 pc 在重新启动过程中卡住了。如果重启时间太长,我是否可以超时?即如果需要超过 100 秒,应该中止重新启动?
import os
restart = raw_input("Do you wish to restart your computer ? (yes / no): ")
if restart == 'no':
exit()
else:
os.system("reboot", timeout(100))...something