Skip to content

Instantly share code, notes, and snippets.

@biscuitvile
Forked from marcosnils/tmate.sh
Last active August 29, 2015 14:17
Show Gist options
  • Save biscuitvile/6596bb00178c20df0264 to your computer and use it in GitHub Desktop.
Save biscuitvile/6596bb00178c20df0264 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
SLACK_WEBHOOK_URL=
DEFAULT_EMOJI=:slack:
CHANNEL=${1:-#general}
AUTHOR="Some user"
tmate -S /tmp/tmate.sock new-session -d && tmate -S /tmp/tmate.sock wait tmate-ready
TMATE_URL=`tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'`
PAYLOAD='payload={"channel": "'$CHANNEL'", "username": "'$AUTHOR'", "text": "I have setup a new tmate session for you to join. Here is the url: '$TMATE_URL'", "icon_emoji": "'$DEFAULT_EMOJI'"}'
curl -sS -o /dev/null -X POST --data-urlencode "$PAYLOAD" $SLACK_WEBHOOK_URL
tmate -S /tmp/tmate.sock attach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment