scripts/superscreen

30 lines
657 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
screen -d -m -S $session
screen -S $session -p $window -X exec printf "\033k%s\033\\" `hostname -s`
for server in $servers
do
let window++
screen -S $session -X screen ssh $server
screen -S $session -p $window -X exec printf "\033k%s\033\\" $server
done
screen -r $session -p 0