starting a screen session on startup

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
zezo
Posts: 1
Joined: Sat Jul 14, 2018 9:57 pm

starting a screen session on startup

Post by zezo »

hi, i have a raspberry pi connected to a small screen without a keyboard i want to be able to let it auto login and start a screen session that i can access and control via SSH. So i chose the custom auto-start option on AutoStart options and added the following command to custom.sh :

Code: Select all

screen -S main
i also tried modifying rc.local with the same command. In both cases using

Code: Select all

 screen -list
via ssh does not show any screen after start up, and the lcd monitor still shows 'please login to continue', am i missing something?
User avatar
WarHawk
Posts: 630
Joined: Thu Jul 20, 2017 8:55 am

Re: starting a screen session on startup

Post by WarHawk »

-m

causes screen to ignore the $STY environment variable. With "screen -m" creation of a new session is enforced, regardless whether screen is called from within another screen session or not. This flag has a special meaning in connection with the '-d' option:

-d
-m Start screen in "detached" mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts.


https://linux.die.net/man/1/screen

Had to do some googlin'

So maybe screen -m-d -S main
might be the command you need

Then when you login with SSH, it should be waiting...but not attached

Tutorial for those that don't know what screen is
https://www.rackaid.com/blog/linux-scre ... nd-how-to/
Post Reply