Last active
January 24, 2020 11:55
Revisions
-
cybic revised this gist
Jan 24, 2020 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,9 @@ # AutoSSH to host and create or connect to tmux session # Multi-hop version. Separate hops with `%`. Assign port with `:` # # $ remux-hop server.example.com sysop # $ remux-hop alice.example.com%bob.example.com sysop # $ remux-hop alice.example.com%[email protected]:2222 sysop # # Author: Oystein Steimler <[email protected]> -
cybic revised this gist
Jan 24, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # AutoSSH to host and create or connect to tmux session # Multi-hop version. Separate hops with `%`. Assign port with `:` # # remux-hop alice.example.com%[email protected]:2222 sysop # # Author: Oystein Steimler <[email protected]> -
cybic revised this gist
Jan 24, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ #!/bin/bash # # AutoSSH to host and create or connect to tmux session # Multi-hop version. Separate hops with `%`. Assign port with `:` # # remux-hop alice.example.com%[email protected]:2222 # # Author: Oystein Steimler <[email protected]> -
cybic revised this gist
Nov 22, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ HLIST=$1; IFS='%' read -a HOPS <<< "$HLIST" AUTOSSHPRM="-M0 -o ServerAliveInterval=10 -o ServerAliveCountMax=2 -o BatchMode=yes" SSHPRM="-A -t" @@ -41,4 +41,4 @@ then else echo SSH; ssh $SSHPRM ${HOPS[0]} $CMD; fi; -
cybic revised this gist
Mar 10, 2016 . 1 changed file with 21 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,28 +1,44 @@ #!/bin/bash # # AutoSSH to host and create or connect to tmux session # Multi-hop version. Separate hops with `#`. Assign port with `:` # # remux-hop alice.example.com#[email protected]:2222 # # Author: Oystein Steimler <[email protected]> HLIST=$1; IFS='#' read -a HOPS <<< "$HLIST" AUTOSSHPRM="-M0 -o ServerAliveInterval=10 -o ServerAliveCountMax=2 -o BatchMode=yes" SSHPRM="-A -t" CMD="if tmux ls | grep ^$2; then tmux att -t $2; else tmux new -s $2;fi"; for ((i=${#HOPS[@]}-1; i>=1; i--)) do PCMD=$(printf %q "$CMD"); ## Separate host from port IFS=':' read -a HOSTPARTS <<< "${HOPS[$i]}" HOP=${HOSTPARTS[0]} if [ -n "${HOSTPARTS[1]}" ] then echo "Setting port $PORT" PORT="-p ${HOSTPARTS[1]} "; fi ## Push a hop to the stack. CMD="if [ \`which autossh\` ] ; then echo 'AutoSSH $HOP $PORT'; autossh $AUTOSSHPRM $SSHPRM $PORT $HOP $PCMD; else echo 'SSH $HOP $PORT'; ssh $SSHPRM $PORT $HOP $PCMD; fi "; done #echo $CMD; #exit; if [ `which autossh` ]; then echo AutoSSH; autossh $AUTOSSHPRM $SSHPRM ${HOPS[$i]} $CMD; else echo SSH; ssh $SSHPRM ${HOPS[0]} $CMD; fi; -
cybic revised this gist
Mar 10, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,6 @@ do done #echo $CMD; if [ `which autossh` ]; then echo AutoSSH; -
cybic created this gist
Mar 10, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/bash # # AutoSSH to host and create or connect to tmux session # Multi-hop version. Separate hops with : # # Author: Oystein Steimler <[email protected]> HLIST=$1; IFS=':' read -a HOPS <<< "$HLIST" AUTOSSHPRM="-M0 -o ServerAliveInterval=10 -o ServerAliveCountMax=2 -o BatchMode=yes" CMD="if tmux ls | grep ^$2; then tmux att -t $2; else tmux new -s $2;fi"; for ((i=${#HOPS[@]}-1; i>=1; i--)) do PCMD=$(printf %q "$CMD"); CMD="if [ \`which autossh\` ] ; then echo AutoSSH; autossh $AUTOSSHPRM -t ${HOPS[$i]} $PCMD; else echo SSH; ssh -t ${HOPS[$i]} $PCMD; fi "; done #echo $CMD; #ssh -t ${HOPS[0]} $CMD if [ `which autossh` ]; then echo AutoSSH; autossh $AUTOSSHPRM -t ${HOPS[$i]} $CMD; else echo SSH; ssh -t ${HOPS[0]} $CMD; fi;