How to start process via SSH, so it keeps running?

我是研究僧i 提交于 2019-11-28 03:42:53

问题


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

sudo python ./webCheck &
sudo python ./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.

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.

How to do it?


回答1:


You should be able to use:

sudo nohup python ./webCheck &

sudo nohup python ./apiCheck &

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.



来源:https://stackoverflow.com/questions/12075642/how-to-start-process-via-ssh-so-it-keeps-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!