From 76f26b92b27583c8bc142eefb6f31a1d518c1cd2 Mon Sep 17 00:00:00 2001 From: Adam Kingsley Date: Tue, 20 Mar 2018 23:42:51 +0100 Subject: [PATCH] Revert "Add a method to send a slack message and call it if a webhook url is specified in the /etc/plexupdate.cron.conf file." This reverts commit 2a0ea3433718141ea5fed9654a10cbb7e7704847. --- extras/cronwrapper | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/extras/cronwrapper b/extras/cronwrapper index b976872..b6b10fa 100755 --- a/extras/cronwrapper +++ b/extras/cronwrapper @@ -15,27 +15,6 @@ # (typically /var/log/daemon.log or /var/log/syslog) # -sendSlackMessage() { - escapedText=$(cat ${1} | sed 's/"/\"/g' | sed "s/'/\'/g" ) - slackUsername=${SLACK_USERNAME:-plexupdate} - - if [ $RET -eq 10 ] || [ $RET -eq 0 ]; then - color="#36a64f" - else - color="#ad2d2d" - fi - ts=`date +%s` - attachment="{\"color\": \"$color\",\"footer\": \"Plex Update\",\"title\": \"Log File\", \"text\": \"$escapedText\", \"ts\": $ts}" - - if [ ! -z "$SLACK_CHANNEL" ]; then - json="{\"channel\": \"$SLACK_CHANNEL\", \"username\": \"$slackUsername\", \"attachments\": [$attachment]}" - else - json="{\"username\": \"$slackUsername\", \"attachments\": [$attachment]}" - fi - - curl -s -X POST -H 'Content-type: application/json' -d "$json" "$SLACK_WEBHOOK_URL" -} - if [ ! -f /etc/plexupdate.cron.conf ]; then echo "ERROR: You have not configured /etc/plexupdate.cron.conf" >&2 exit 255 @@ -80,11 +59,6 @@ if [ $RET -ne 0 ] ; then # Make sure user gets an email about this (when not success or if user has specified when) cat ${LOGFILE} >&2 - # If there's a slack webhook specified then send a slack message with the log output - if [ ! -z "$SLACK_WEBHOOK_URL" ]; then - sendSlackMessage ${LOGFILE} - fi - # Output will produce a cron email, so we can reset the exit status if [ $RET -eq 10 ]; then RET=0