tunnelier command
This commit is contained in:
@@ -11,6 +11,11 @@ to kill existing ssh processes. You don't need to keep the program on
|
||||
to remember connected sessions.
|
||||
|
||||
Configuration stored in: $CONF
|
||||
|
||||
If run with arguments, runs an ssh tunnel with arguments:
|
||||
ssh-tunnelier hostname [local-port] remote-port
|
||||
|
||||
If local port missing, the same port assumed in local
|
||||
"
|
||||
exit 0
|
||||
}
|
||||
@@ -20,7 +25,6 @@ for (( i=1; i<=$#; i++ )); do
|
||||
[[ ${!i} = "--help" ]] && _helpexit
|
||||
done
|
||||
|
||||
|
||||
[[ -f "$CONF" ]] || {
|
||||
echo No config file.
|
||||
echo "$CONF" each line like:
|
||||
@@ -82,10 +86,24 @@ function read_config() {
|
||||
done < <( grep -v ^# "$CONF" | grep '[a-zA-Z]' )
|
||||
}
|
||||
|
||||
function run_args() {
|
||||
HOST="$1"
|
||||
LOCAL="$2"
|
||||
REMOTE="$3"
|
||||
[[ -z "$REMOTE" ]] && REMOTE="$LOCAL"
|
||||
echo Connect to $HOST
|
||||
ssh -f -n -L "${LOCAL}:localhost:${REMOTE}" "$HOST" "sleep $MAGIC_TIME"
|
||||
}
|
||||
|
||||
function run_command() {
|
||||
eval $( get_command "$1" )
|
||||
}
|
||||
|
||||
|
||||
[[ -n "$2" ]] && {
|
||||
run_args "$@"
|
||||
}
|
||||
|
||||
while true; do
|
||||
ids=()
|
||||
i=1
|
||||
|
||||
Reference in New Issue
Block a user