如何通过SSH启动过程,所以它一直运行?过程、SSH

2023-09-11 09:14:06 作者:余生一个浪

我有三个文件: monitor.sh,启动Python脚本:

I have three files: monitor.sh, which starts python scripts:

sudo python ./webCheck &
sudo python ./apiCheck &

和otherones,WebCheck系统和放大器; apiCheck:它应该在后台运行,当我关闭终端。它会检查我的其他网站的可用性,无限循环。

and the otherones, webCheck & apiCheck: it is supposed to run in the background, after I close the terminal. It checks my other website's availability, in an endless loop.

我不能让它的工作,我想的nohup,但不能得到语法正确。 WebCheck正必须与须藤运行。请问nohup这个被列入也在sh的脚本?我想作为monitor.sh只是应该开始另外两个,这样一个并不需要的nohup。

I can't get it to work, I am trying nohup, but can't get the syntax right. webCheck have to be run with sudo. Does nohup be included also in the sh script? I guess as the monitor.sh is just supposed to start other two, so that one doesn't need nohup.

怎么办呢?

推荐答案

您应该能够使用:

须藤的nohup蟒蛇./webCheck和放大器; 须藤的nohup蟒蛇./apiCheck&安培;

sudo nohup python ./webCheck & sudo nohup python ./apiCheck &

我不认为你monitor.sh会需要它,因为它应该采取一个相对短的时间启动其他两个。不过我不是正面的,如果这两个检查将成为monitor.sh的儿童,这可能最终会成为一个问题。

I don't think your monitor.sh will need it, since it should take a relatively short time to start the other two. However I'm not positive if the two checks would become children of monitor.sh, which may end up being an issue.