Created
April 4, 2010 08:50
-
-
Save kyleconroy/355248 to your computer and use it in GitHub Desktop.
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 characters
import twilio | |
import subprocess | |
import time | |
import sys | |
ACCOUNT = "AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
AUTH = "CNNNNNNNNNNNNNNNNNNNNNNNNNN" | |
API_VERSION = '2008-08-01' | |
account = twilio.Account(ACCOUNT, AUTH) | |
NUMBER = "NNNNNNNNNN" | |
phone_numbers = [ | |
"1234567890", | |
"1234567890", | |
"1234567890", | |
"1234567890", | |
"1234567890", | |
] | |
def send_texts(): | |
account = twilio.Account(ACCOUNT, AUTH) | |
for number in phone_numbers: | |
d = { | |
"From": NUMBER, | |
"To": number, | |
"Body": "THE SERVER IS UP", | |
} | |
account.request('/%s/Accounts/%s/SMS/Messages' % \ | |
(API_VERSION, ACCOUNT), 'POST', d) | |
if __name__=="__main__": | |
while True: | |
p = subprocess.Popen(["ssh","-q","SERVER","svnserve","-t"], | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE) | |
time.sleep(60) | |
retcode = p.poll() | |
if retcode: | |
output = p.stdout.read() | |
send_texts() | |
sys.exit(0) | |
else: | |
print "Took too long, starting over" | |
p.kill() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment