Created
July 8, 2016 16:00
-
-
Save x1024/96f304f64f18f41b9224cdf1a5a5eebb to your computer and use it in GitHub Desktop.
slack notifications when a line is added to a logfiel
This file contains 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
#!/usr/bin/env python2.7 | |
from slacker import Slacker # https://github.com/os/slacker | |
slack = Slacker('SLACK API TOKEN HERE') | |
while True: | |
line = raw_input() | |
msg = 'A line was posted: %s' % line | |
print msg | |
slack.chat.post_message('@slackbot', msg) |
This file contains 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
tail -n 0 -f file.txt | ./notifier.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment