Start Daemonised GNU Screen from script a allow calling script to end
- by tez
I have a script on an embedded device that calls screen to start if a user logs in via a ssh session...
#!/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
However this keeps the calling script active till the screen session exits,even if it's detached.
What I want to do is have the calling script finish and exit while the screen session stays active. I've tried daemonising the screen -x lines and adding an & to the end of the screen -x lines neither of which work properly.
Ideas?