I'm trying to start a python script on my Raspberry Pi through an SSH connection from my main machine. But obviously, as soon as I turn off my main machine the SSH terminal will close and with that my python script will be cancelled.
I'm looking for a method where I can use SSH to open a terminal that runs on the Pi internally and does not close as soon as I turn off my main machine. This should be possible without connecting keyboard and screen to the raspberry, right?
Thank you so much for any tips
you can use screen, tmux or nohup for this:
screen:
screen manager with VT100/ANSI terminal emulation
tmux:
terminal multiplexer
nohup:
run a command immune to hangups, with output to a non-tty
screen and tmux will start virtual session that you can connect to later, for hotkeys settings see manual pages
nohup will just avoid to kill the process for example:
yes nohup;
this will write the output from the program "yes" to the nohup.out file and it will not be terminated by disconnection of your ssh
Opening and running local terminal through SSH