I am running a Python script filename.py via ssh. Once I'm logged into the remote machine, I run:
python filename.py &
However, when I close out of the terminal, it appears the python stops running. Why is this? I thought an ampersand & at the end of a statement meant the program kept running?
Use nohup:
nohup python filename.py &
nohup [command] & will run the job in the background and return you back to the shell.
I am not so far into python in shell, but you can use screen in ssh related enviroments
For example:
sudo apt-get install screen
screen -m
This will create virual tty (pty)
Then run your program
python prog.py &
Hope it will work fine for you, have a nice day!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With