Betriebssystem mit deprimierender Wirkung (REUPLOAD der Repo von 2018)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

shutdown.py 420B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. import sys
  3. import json
  4. import struct
  5. import os
  6. def getMessage():
  7. rawLength = sys.stdin.read(4)
  8. if len(rawLength) == 0:
  9. sys.exit(0)
  10. messageLength = struct.unpack('@I', rawLength)[0]
  11. message = sys.stdin.read(messageLength)
  12. return json.loads(message)
  13. while True:
  14. receivedMessage = getMessage()
  15. if receivedMessage == "kill":
  16. os.system("shutdown now -h")