Last active
January 28, 2020 00:00
-
-
Save ianlini/648943f4d0d61c58ac8b166ff3c8acb2 to your computer and use it in GitHub Desktop.
Revisions
-
ianlini revised this gist
Jan 28, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash set -e LOG_FILE='/var/log/motion/motion.log' WEBHOOK_URL='https://hooks.slack.com/services/...' USERNAME='motion' -
ianlini revised this gist
Jan 23, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash set -ex LOG_FILE='/var/log/motion/motion.log' WEBHOOK_URL='https://hooks.slack.com/services/...' USERNAME='motion' -
ianlini revised this gist
Jun 9, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash LOG_FILE='/var/log/motion/motion.log' WEBHOOK_URL='https://hooks.slack.com/services/...' USERNAME='motion' CHANNEL='camera' -
ianlini revised this gist
Mar 17, 2018 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,12 @@ #!/bin/bash LOG_FILE='/var/log/motion/motion.log' WEBHOOK_URL='https://hooks.slack.com/services/... USERNAME='motion' CHANNEL='camera' function send_slack_message { DATA="payload={\"username\": \"${USERNAME}\", \"channel\": \"${CHANNEL}\", \"text\": \"$1\"}" echo "data: ${DATA}" curl -X POST --data-urlencode "${DATA}" "${WEBHOOK_URL}"; echo "" -
ianlini created this gist
Mar 3, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash LOG_FILE='/var/log/motion/motion.log' WEBHOOK_URL='https://hooks.slack.com/services/...' USERNAME='motion' function send_slack_message { DATA="payload={\"username\": \"${USERNAME}\", \"text\": \"$1\"}" echo "data: ${DATA}" curl -X POST --data-urlencode "${DATA}" "${WEBHOOK_URL}"; echo "" } send_slack_message 'motion alert started!' tail -n0 -F "${LOG_FILE}" | while read LINE; do send_slack_message "${LINE}" done