Skip to content

Instantly share code, notes, and snippets.

@penguinwokrs
Last active June 18, 2018 12:37
Show Gist options
  • Save penguinwokrs/3ad0054eff759e2709c13cc9025b97b2 to your computer and use it in GitHub Desktop.
Save penguinwokrs/3ad0054eff759e2709c13cc9025b97b2 to your computer and use it in GitHub Desktop.
通信速度を計測して、チャンネルに投稿するスクリプト
#!/bin/bash
res=$(speedtest --server 14623 --simple)
USERNAME="webhookbot"
CHANNEL="#speedtest"
ICON=":bike:"
WEBHOOK_URL="https://hooks.slack.com/services/ID"
author="author name"
data=`cat << EOF
payload={
"channel": "$CHANNEL",
"username": "$USERNAME",
"icon_emoji": "$ICON",
"text": "${res}"
}]
}
EOF`
curl -X POST --data-urlencode "$data" $WEBHOOK_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment