summaryrefslogtreecommitdiff
path: root/localautossh
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-03-28 09:28:55 +0000
committerJonas Smedegaard <dr@jones.dk>2008-03-28 09:28:55 +0000
commit5fea6320214a1cb00418f52895fd11fc2522771c (patch)
tree7a0fe5715a3a7fdce4844bffdd12b0b28a8061c0 /localautossh
parentb2ba56eb62499c5760fdde4bd3b598927ee9f495 (diff)
Support supplying remote port number.
Diffstat (limited to 'localautossh')
-rwxr-xr-xlocalautossh9
1 files changed, 7 insertions, 2 deletions
diff --git a/localautossh b/localautossh
index 92aa7a4..053394d 100755
--- a/localautossh
+++ b/localautossh
@@ -6,7 +6,7 @@
# to 22 on the local host. On remote host do:
# ssh -p 2200 localhost
#
-# $Id: localautossh,v 1.1 2007-08-07 16:34:50 jonas Exp $
+# $Id: localautossh,v 1.2 2008-03-28 09:28:55 jonas Exp $
#
if [ -z "$SSH_ASKPASS" ]; then
@@ -18,6 +18,11 @@ if [ "X$SSH_AUTH_SOCK" = "X" ]; then
ssh-add $HOME/.ssh/id_rsa
fi
+remoteport="2200"
+if [ -n "$2" ]; then
+ remoteport="$(expr 2200 + "$2")"
+fi
+
#AUTOSSH_POLL=600
#AUTOSSH_PORT=20000
#AUTOSSH_GATETIME=30
@@ -26,4 +31,4 @@ fi
#AUTOSSH_PATH=/usr/local/bin/ssh
export AUTOSSH_POLL AUTOSSH_LOGFILE AUTOSSH_DEBUG AUTOSSH_PATH AUTOSSH_GATETIME AUTOSSH_PORT
-autossh -2 -fN -M 20000 -R 2200:localhost:22 "$1"
+autossh -2 -fN -M 20000 -R $remoteport:localhost:22 "$1"