Last active
December 26, 2015 21:38
-
-
Save jeekl/7216949 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Checks if a tmux session with name $host exists, on remote $host. | |
# if so connect to it otherwise create session and connect to it. | |
host=$1 | |
ssh $USER@$host tmux has-session -t $host 2>/dev/null | |
if [ "$?" -eq 1 ] ; then | |
ssh $USER@$host tmux new-session -d -s $host | |
fi | |
ssh -t $USER@$host tmux attach-session -t $host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment