Skip to content

Instantly share code, notes, and snippets.

@didmar
Created October 18, 2016 07:16
Show Gist options
  • Save didmar/2df29350949f37d6d3b165c5747f1812 to your computer and use it in GitHub Desktop.
Save didmar/2df29350949f37d6d3b165c5747f1812 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Runs the given command and notifies you through Slack when its done !
# You must first create a slack hook and set your username
URL="https://hooks.slack.com/services/T000000000/B0000000/xxxxxxxxxxxxxxx"
USERNAME="@your_user_name_here"
COMMAND=$*
$COMMAND
RET=$?
curl -X POST --data-urlencode "payload={\"channel\": \"${USERNAME}\", \"username\": \"wakemeup\", \"text\": \"(${RET}) Command terminated: ${COMMAND}\", \"icon_emoji\": \":ghost:\"}" $URL > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment