简体   繁体   English

如果进程被杀死,如何运行命令

[英]How to run a command if the process is Killed

how to keep the command to run if the process is auto-killed 如果进程被自动杀死,如何保持命令运行

example: 例:

python3 "command" then, command running if, Killed (process killed or stop) then, run the early command python3“命令”然后,如果命令运行,则杀死,(杀死进程或停止),然后运行早期命令

If you want to say is: 'The process running in the terminal stopped, you want to run once in the second'. 如果要说的是:“在终端中运行的进程已停止,您想每秒运行一次”。 Then: 1, you can find it by the up arrow in the cursor keys of your keyboard; 然后:1,您可以通过键盘的光标键中的向上箭头找到它; You can type 'sudo gedit ~/.bash_history' or 'history | 您可以输入“ sudo gedit〜/ .bash_history”或“ history | less' in the terminal to see the history commands you entered. 更少”,以查看您输入的历史记录命令。

If you want to say is: 'Your process may be stopped for some reason, but you want it to start running again' You can try this: 1, create a script to run your process; 如果您想说的是:“您的进程可能由于某种原因而停止了,但是您希望它再次开始运行”,您可以尝试以下操作:1,创建一个脚本来运行您的进程; 2, in your code to find the reasons that may cause your program to stop, and then use the conditional statement to judge, once your code stops calling the script created above. 2,在您的代码中查找可能导致您的程序停止的原因,然后使用条件语句进行判断,一旦您的代码停止调用上面创建的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM