diff options
author | root <root@monitoring.shack> | 2012-09-13 23:39:42 +0000 |
---|---|---|
committer | root <root@monitoring.shack> | 2012-09-13 23:39:42 +0000 |
commit | d5d39fc3d56b021b642ee6e1d5625524ebbc4d99 (patch) | |
tree | d5bd5a82e5f1beeb53a4904677c23fd5e5052e38 | |
parent | a401be4bc5e393d35a220d0e9b33482794d66597 (diff) |
initial commit
-rw-r--r-- | Monitoring/conf/shack_guests.cfg | 2 | ||||
-rw-r--r-- | god/twinter/init_stripped.py | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/Monitoring/conf/shack_guests.cfg b/Monitoring/conf/shack_guests.cfg index 5832725a..67abdfce 100644 --- a/Monitoring/conf/shack_guests.cfg +++ b/Monitoring/conf/shack_guests.cfg @@ -30,7 +30,7 @@ define host{ define host{ use generic-host host_name chinaman - parents shack-router + parents shack-gw alias Chinaman Bitcoin Mining Rig #address 10.42.0.96 #_TINC_ADDRESS 10.7.7.6 diff --git a/god/twinter/init_stripped.py b/god/twinter/init_stripped.py new file mode 100644 index 00000000..092d239a --- /dev/null +++ b/god/twinter/init_stripped.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +import os.path +import sys +import tweepy +from socket import * +CONSUMER_KEY = '' +CONSUMER_SECRET = '' +ACCESS_KEY= '' +ACCESS_SECRET = '' +printer = "" + +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) +auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) +api = tweepy.API(auth) +mention = api.mentions()[0] +mention_stripped = mention.text.replace("@shacktwinter","").lstrip().rstrip().replace(" "," ")[:32] +f = open(os.path.dirname(os.path.abspath(sys.argv[0]))+"/msg_file","r+") +last = f.read() +#sys.exit(23) +if last == mention_stripped: + print "received old message" + sys.exit(23) +else: + print "received new message: %s" % mention_stripped + + s = socket(AF_INET, SOCK_STREAM) + send_message = \ + '\x1b%%-12345X@PJL JOB\n@PJL RDYMSG DISPLAY="%s"\n@PJL EOJ\n\x1b%%-12345X' % (mention_stripped, ) + s.connect((printer, 9100)) + s.send(send_message) + s.close() + f.seek(0) + f.truncate(0) + f.write(mention_stripped) + f.close() + if not mention.user.following: + mention.user.follow() + api.update_status("@%s i appreciate your message '%s' for twinter! Ready Message updated." %(mention.user.screen_name,mention_stripped.upper()),in_reply_to_status_id=mention.id) |