News How To Run Long-running Scripts on a Raspberry Pi

If you're using tmux and you only have one session, it's far easier to reconnect with tmux attach-session

But by far the easiest method of running a script without it being terminated when you disconnect from SSH is using nohup
 
Unless it isn't on the Pi for some reason, if you have a long-running script that you don't necessarily need to connect back to you can always nohup it.
 
Great tutorial! Tmux is a great tool for running one-off, long running scripts. I'm also a big fan of supervisor.
 
I tried the tutorial but I get an error message when I enter

pi@raspberrypi:~ $ sudo systemctl start myscript && sudo systemctl enable myscript


Failed to start myscript.service: Unit myscript.service has a bad unit file setting.
See system logs and 'systemctl status myscript.service' for details.


I named my script my_script.py and copied and pasted from the website so there should be no spelling or syntax errors