scripts/superscreen

30 lines
698 B
Text
Raw Normal View History

#!/bin/sh
# superscreen: open a screen session with ssh connections to some servers
window=0
session="default"
servers="db dns ftp mail web"
# wipe dead screens
screen -wipe
if screen -list | grep -q "$session"
then
echo "Error: session \"$session\" already exists; please kill it first."
echo "type \"screen -X -S $session quit\" to do so."
exit 1
fi
2015-09-10 22:02:26 +02:00
# main screen (physical host)
screen -d -m -S $session -t `hostname -s`
2015-09-10 22:02:26 +02:00
# servers' screens : open a ssh connexion from the host to them, then rename it
for server in $servers
do
2015-09-10 22:02:26 +02:00
window=$(( window + 1 ))
screen -S $session -X screen ssh $server
2015-09-10 22:02:26 +02:00
screen -S $session -p $window -X title $server
done
screen -r $session -p 0