I am an avid user of the utility screen, it's my favorite window manager! Below is a couple of shell scripts for screen users.
- ns <hostname> - will start a new screen and ssh to the <hostname> provided.
- na <application> - will start a new screen and start the <application> provided.
- ns <hostname> - will start a new screen and ssh to the <hostname> provided.
- na <application> - will start a new screen and start the <application> provided.
Code:
#!/bin/bash
if [ $# = 1 ]; then
# echo "number of arguments is $#"
screen -t $1 ssh -o ServerAliveInterval=300 -o TCPKeepAlive=yes $1
else
echo "USAGE: `basename $0` <hostname>"
echo "This will start a ssh session to a server in a new screen"
fi
Code:
#!/bin/bash
if [ $# = 1 ]; then
# echo "number of arguments is $#"
screen -t $1 $1
else
echo "USAGE: `basename $0` <hostname>"
echo "This will start an application on a new screen"
fi