curl https://gist.githubusercontent.com/sakakendo0321/f634df4c2e9e20b64b4d9c9f898dfea1/raw/581e4adba8a0a00fe4704abd486efabcc11f68c6/setup.sh |sh
# rewrite url and slack token
Last active
June 12, 2019 04:14
-
-
Save sakakendo/f634df4c2e9e20b64b4d9c9f898dfea1 to your computer and use it in GitHub Desktop.
This file contains 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
channnel= # enter channel name | |
message='hostname:'$(cat /etc/hostname)',ip:'$(ip addr|egrep -o 'inet\ 192\.168\.0\.[0-9]{1,3}' |sed s/inet\ //g )',ssid:'$(iwconfig wlan0 |grep -o ESSID:\"[^\"]*\") | |
function send(){ | |
curl -s -XPOST "https://slack.com/api/chat.postMessage?token=$SLACK_TOKEN&channel=$channnel&username=raspi&text="+"$@" >>/dev/null | |
} | |
send $message |
This file contains 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
curl https://gist.githubusercontent.com/sakakendo0321/f634df4c2e9e20b64b4d9c9f898dfea1/raw/1346a7bd122cdf7e22b17589f462940c207c0c12/ip2slack.sh >~/.ip2slack.sh | |
echo "export SLACK_TOKEN=''" >>~/.bashrc | |
echo "source .ip2slack.sh" >>~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment