This question already has an answer here:
I'm getting very annoyed here right now. I've been trying to get something very easy done for way too long now.
I am running a python script on my Pi Zero W (in CLI) to control my smart lights, this means, of course, that the script is using network access right off the bat. I want to be able to control and monitor this script directly on the pi (via keyboard and monitor) and via an external pc via ssh. I've made this work using
screen. Now I want the Pi to automatically create the screen socket and execute the python script.
To do this manually I'm successfully using the following command:
screen -S startup /home/pi/launcher
I'm using the name startup to connect to the correct screen on the separate pc.
/home/pi/launcher is a separate file that simply calls the python script.
I can't find any way to execute this single line of code automatically in such a way that things work. I think I've tried every method on Google, none with any success.