Start Daemonised GNU Screen from script a allow calling script to end
Posted
by
tez
on Server Fault
See other posts from Server Fault
or by tez
Published on 2012-09-24T19:32:06Z
Indexed on
2012/09/24
21:39 UTC
Read the original article
Hit count: 235
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?
© Server Fault or respective owner