run_tmate.sh 330 B

12345
  1. #!/bin/sh
  2. /bin/tmate -S /tmp/tmate.sock new-session -d # Launch tmate in a detached state
  3. /usr/bin/timeout -t 20 /bin/tmate -S /tmp/tmate.sock wait tmate-ready # Blocks until the SSH connection is established
  4. /bin/tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}' # Prints the SSH connection string