diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2022-07-15 10:17:50 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2022-07-15 10:17:50 -0400 |
commit | 4eedbfcbb50559fc310db5f4922bb414cbe61708 (patch) | |
tree | e372c4d3dbde0ad7ac49a98e004cb9c883d928e5 | |
parent | 6d67581c8bd68db17ab7351d683c28dc013503d3 (diff) | |
download | jupyter_safe_port-4eedbfcbb50559fc310db5f4922bb414cbe61708.tar.gz |
Do not fork ssh session into background by default. Use -f to daemonize ssh.
-rwxr-xr-x | bin/jupyter_safe_port | 13 |
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" |