Skip to content

Instantly share code, notes, and snippets.

@mjkramer
Last active April 30, 2024 01:53
Show Gist options
  • Save mjkramer/9936b6d30e5d9d5abe4368bffff438b3 to your computer and use it in GitHub Desktop.
Save mjkramer/9936b6d30e5d9d5abe4368bffff438b3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
host=login12
port=12345
oldTunnel=$(ps ux | grep ssh | grep "\\-L $port")
if [[ -n "$oldTunnel" ]]; then
pid=$(echo "$oldTunnel" | awk '{print $2}')
kill "$pid"
fi
ssh -Nf -L $port:$host:$port saul.nersc.gov
xpra attach tcp://localhost:$port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment