I am writing a script to run and a background process inside a stray computer. It seems that every time the script ends and the ssh session ends, the background process also ends.
The command is executed here:
vagrant ssh -c "cd /vagrant/src; nohup python hello.py > hello.out > 2>&1 &"
hello.pyin fact, it is only a flask development server. If I were to log in to ssh interactively and run the command nohupmanually, after the session was closed, the server would continue to work. However, if I were to run it through vagrant ssh -c, it is almost as if the command had never been run at all (i.e. the hello.out file was not created). What is the difference between starting it manually and using the ssh -c firewall, and how to fix it so that it works?
source
share