MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / reboot_system

Method reboot_system

utils.py:590–602  ·  view source on GitHub ↗
(self, handler)

Source from the content-addressed store, hash-verified

588 handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8'))
589
590 def reboot_system(self, handler):
591 try:
592 command = "sudo reboot"
593 subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
594 handler.send_response(200)
595 handler.send_header("Content-type", "application/json")
596 handler.end_headers()
597 handler.wfile.write(json.dumps({"status": "success", "message": "System is rebooting"}).encode('utf-8'))
598 except subprocess.CalledProcessError as e:
599 handler.send_response(500)
600 handler.send_header("Content-type", "application/json")
601 handler.end_headers()
602 handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8'))
603
604 def shutdown_system(self, handler):
605 try:

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected