aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2022-07-15 10:17:50 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2022-07-15 10:17:50 -0400
commit4eedbfcbb50559fc310db5f4922bb414cbe61708 (patch)
treee372c4d3dbde0ad7ac49a98e004cb9c883d928e5
parent6d67581c8bd68db17ab7351d683c28dc013503d3 (diff)
downloadjupyter_safe_port-4eedbfcbb50559fc310db5f4922bb414cbe61708.tar.gz
Do not fork ssh session into background by default. Use -f to daemonize ssh.
-rwxr-xr-xbin/jupyter_safe_port13
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/jupyter_safe_port b/bin/jupyter_safe_port
index 91981c0..943fbeb 100755
--- a/bin/jupyter_safe_port
+++ b/bin/jupyter_safe_port
@@ -16,6 +16,7 @@ Arguments:
-c only generate the SSH connection string
-d dump ports (useful in scripts)
format: local remote
+ -f apply SSH argument to daemonize session (i.e. ssh -f)
" $(basename $0)
}
@@ -27,6 +28,8 @@ fi
PORT_MAX=65535
dump=0
connect_only=0
+daemonize=0
+ssh_args=(-N)
# Parse arguments
@@ -60,6 +63,11 @@ while [[ $i < $argc ]]; do
(( i++ ))
continue
;;
+ f)
+ daemonize=1
+ (( i++ ))
+ continue
+ ;;
*)
echo "error: unknown argument" >&2
usage
@@ -144,5 +152,8 @@ if ! (( connect_only )); then
echo
fi
+if (( daemonize )); then
+ ssh_args+=(-f)
+fi
echo "Connect via:"
-echo "ssh -N -f -L$port_local:localhost:$port_remote $user@$server"
+echo "ssh ${ssh_args[@]} -L$port_local:localhost:$port_remote $user@$server"