aboutsummaryrefslogtreecommitdiff
path: root/assh
blob: fb4c8b6633b8334975c229272f011a14519ed39c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#
# simple autossh and screen wrapper
#

BASENAME="`basename $0`"
DEST="$1"
COMMAND="$2"

if [ -z "$DEST" ]; then
  exit 1
fi

if [ "$BASENAME" == "asshs" ] || [ "$BASENAME" == "shells" ]; then
  # Remote screen shell using autossh
  if [ "$COMMAND" == "root" ]; then
    autossh $DEST -t -- sudo screen -x
  else
    autossh $DEST -t -- screen -x $COMMAND
  fi
elif [ "$BASENAME" == "shelll" ]; then
  # Local screen shell
  wscreen $*
else
  # Remote shell using autossh
  autossh $DEST -t -- $COMMAND
fi