aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"