[kwlug-disc] Quick survey on tmux
Khalid Baheyeldin
kb at 2bits.com
Sun Sep 11 09:55:43 EDT 2022
I do the same with screen ...
I have a screen session always on my home server with connections/sessions
to
other servers and such.
I scripted this over a decade ago, by having a shell script called
checkscreen
run from .bash_profile with the following
TMP=/tmp/screen.$$
screen -ls > $TMP
if grep -q "No Sockets" $TMP; then
# There are no screen sessions. Create one
echo "There are no screen sessions. Creating a new one!"
echo -n "Hit Enter to continue ..."
read NL
rm -f $TMP
screen -S main
elif grep -q "1 Socket " $TMP; then
# There is a main session. Reattach it silently.
echo "Reattaching to existing screen session."
echo
echo "Hit Enter to continue ... \c"
read ENTER
rm -f $TMP
screen -d -r
else
# List the sessions
echo "You have the following screen sessions:"
rm -f $TMP
screen -ls
fi
So, if a session exists, I connect to it. If no session exists, such as
when the
server is rebooted, new screens are created according to what I have in
.screenrc.
There is no xterm if that is what you want though. These are all shell
sessions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20220911/761cb3e6/attachment.htm>
More information about the kwlug-disc
mailing list