Advertisement
Guest User

Untitled

a guest
Mar 19th, 2012
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # vim: set fileencoding=utf-8 :
  3. import sys
  4. import os
  5.  
  6. def main():
  7.     msg = sys.stdin.read()
  8.     rcpt = sys.argv[1]
  9.  
  10.     try:
  11.          rcpt = sys.argv[1]
  12.     except:
  13.         print "Invalid arguments! Usage:  <recipient>"
  14.         sys.exit(1)
  15.  
  16. #use gnokii to send sms
  17.     gnokii = os.system("echo " + msg + " | /usr/bin/sudo /usr/bin/gnokii --config /home/zenoss/gnokiirc --sendsms " + rcpt)
  18.  
  19. #log msg to file
  20.     outfile = open ('/usr/local/zenoss/zenoss/log/python-test-log', 'w')
  21.     outfile.write(msg)
  22.  
  23. #execute
  24. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement