Last active
April 8, 2021 17:40
-
-
Save brycesch/ea041a2794f51f89c980663fbf1a3a7a to your computer and use it in GitHub Desktop.
tail file to webhook endpoint
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 | |
| # chmod a+x tails.sh | |
| # nohup ./tails.sh foobar.log webhook_url & | |
| # use nohup if you want the cammand to persist after your session ends | |
| # | |
| # slack | |
| tail -n0 -F "$1" | while read LINE; do | |
| (echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \ | |
| "payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" "$2"; | |
| done |
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 | |
| # chmod a+x tails.sh | |
| # nohup ./tails.sh foobar.log webhook_url & | |
| # use nohup if you want the cammand to persist after your session ends | |
| # | |
| # msteams | |
| tail -n0 -F "$1" | while read LINE; do | |
| (echo "$LINE" | grep -e "$3") && curl -H "Content-Type: application/json" -d "{\"text\": \"$(echo $LINE| sed "s/\"/'/g")\"}" "$2" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment