Created
August 18, 2017 18:56
-
-
Save sletix/556bdf3631de5fa01e3676e7f110516e to your computer and use it in GitHub Desktop.
sql2slack
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
#!/bin/bash | |
## settings: ---- | |
# db | |
host="localhost" | |
db="dbname" | |
user="sletix" | |
password="" | |
# slack hook | |
slack_webhook="https://hooks.slack.com/services/XXXXXXX/XXXXXXX/YYYYYyyyyYYYYYyyyyYY" | |
title="Sample Query" | |
result=$(psql postgresql://$user:$password@$host/$db << EOF | |
/* Write your query here: */ | |
EOF) | |
curl -X POST --data "{\"text\":\":alien:[$title]\n$result\"}" $slack_webhook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment