Guest User

Untitled

a guest
Oct 17th, 2015
163
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. import sys
  4. import os
  5. from datetime import timedelta
  6.  
  7. if sys.argv[1] == "Standheizung":
  8. print "Standheizung wird gestartet"
  9. os.system("sudo gpio write 8 1")
  10. elif sys.argv[1] == "reboot":
  11. print "Das System wird neugestartet"
  12. os.system("shutdown -r now")
  13. elif sys.argv[1] == "uptime":
  14. with open('/proc/uptime', 'r') as f:
  15. uptime_seconds = float(f.readline().split()[0])
  16. uptime_string = str(timedelta(seconds = uptime_seconds))
  17. print(uptime_string[:-7])
  18. #else:
  19. #falls kein Argument zutrifft
RAW Paste Data