Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 469
Kokesh Avatar asked Aug 22 '12 14:08

Kokesh


1 Answers

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.

like image 124
gsteiner Avatar answered Sep 23 '22 05:09

gsteiner