Starting screen from logon script

Another Sillyname <anothersname-gM/[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <CAOS+5GF6i1-Q8KwVK2hBTnUknGV8pDpUYtEsXwRujzQUC8mnsw@mail.gmail.com>
Hi

I have an embedded device that I want to start screen during an ssh logon.

I have the following script.

#!/bin/sh

SCREENRUNNING=`pgrep SCREEN`

if [ -z "$SCREENRUNNING" ]; then

    echo "Screen not running so let's start the Master session
    sleep 2
    screen -dmS Master
    sleep 2
    screen -x root/Master


else

    echo "Screen is already running let's connect to existing session"

    sleep 2
    screen -x root/Master

fi

This starts screen correctly without problems and gets called from
/etc/config/profile when you do a ssh logon.

However this script stays active until screen is fully shut down, this
is a problem as when you detach from the session and then logoff the
device you end up leaving orphaned scripts each time you log back on.

Is there a way to start the screen -x root/Master session and still
allow this calling script to finish?

Thanks
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.