Last active
March 27, 2019 06:06
-
-
Save elit69/00486e5da8862107fc1f02fda513f8b2 to your computer and use it in GitHub Desktop.
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
# wget https://gist.githubusercontent.com/elit69/00486e5da8862107fc1f02fda513f8b2/raw/a0d8714f33eb28596af5fcec23d1b81604bff366/watch.sh | |
# chmod +xr watch.sh | |
# ./watch.sh '' '' '' '' > watch.log & | |
# $1 = *.log | |
# $2 = pattern1 | |
# $3 = pattern2 | |
# $4 = web hook end point | |
tail -Fn0 $1 | \ | |
while read line ; do | |
echo $line | grep "$2" | grep "$3" | |
if [ $? = 0 ] | |
then | |
line=${line//\"/\\\"} | |
printf -v json -- '{ "text": "%s"}' "$line" | |
curl --request POST --url $4 --header 'content-type: application/json' --data "$json" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment