崩溃后如何重新运行Linux? [英] How to re-run process Linux after crash?

查看:71
本文介绍了崩溃后如何重新运行Linux?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有从Linux(Cent OS)运行的Python脚本。

I have Python script, that is run from Linux(Cent OS).

如何永久运行此进程(脚本)?还是会在崩溃后重新运行?

How can I run this process(script) forever? Or such as it will be re-run after crash?

推荐答案

1种方式的bash脚本

1 way bash script

while true;
do
    python index.py 
done

2种方式开始python脚本

2 way start python script

import os
while True:
    os.system("python index.py")

从外部python脚本 import index.py ,然后启动外部脚本。

3 way from external python script import index.py and then start external script.

这篇关于崩溃后如何重新运行Linux?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆