use Slack for updates instead of email

This commit is contained in:
Raymond P. Burkholder 2016-09-27 15:58:12 -03:00 committed by GitHub
parent ab4ff14abc
commit a1fd500da1
1 changed files with 12 additions and 3 deletions

View File

@ -5,8 +5,14 @@
# raymond@burkholder.net # raymond@burkholder.net
# http://blog.raymond.burkholder.net # http://blog.raymond.burkholder.net
# requires use of (with some modifications, will post): # requires use of:
# https://github.com/enigma-io/pd-trigger # https://github.com/juanpabloaj/slacker-cli but install with pip
# https://api.slack.com/bot-users
# https://my.slack.com/apps/build/custom-integration, choose bots, create new one, and add token
# https://my.slack.com/admin#disabled) to delete test bots
# apt-get install python-pip
# pip install slacker-cli
# #git clone https://pypi.python.org/pypi/slacker-cli/
# user defined settings # user defined settings
txtEmail="name@example.com" txtEmail="name@example.com"
@ -15,6 +21,8 @@ txtSeparator="==============================\n"
nTrigger=4 nTrigger=4
nAttempts=5 nAttempts=5
txtPdServiceKey="000000000000000" txtPdServiceKey="000000000000000"
txtSlackBotToken="xoxb-something-or-other"
txtSlackChannel="pathloss"
declare -A nodes declare -A nodes
nodes=( \ nodes=( \
@ -116,7 +124,8 @@ else
response=$(cat ${tmpLog} | ./pd-trigger.sh -L -s "${txtPdServiceKey}" -d "${status}") response=$(cat ${tmpLog} | ./pd-trigger.sh -L -s "${txtPdServiceKey}" -d "${status}")
fi fi
# attempt an email # attempt an email
cat ${tmpLog} | mail -s "${txtSubject}:${status}" ${txtEmail}; #cat ${tmpLog} | mail -s "${txtSubject}:${status}" ${txtEmail};
cat ${tmpLog} | /usr/local/bin/slacker -c ${txtSlackChannel} -t ${txtSlackBotToken}
fi fi
fi fi