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

Method shutdown_system

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

Source from the content-addressed store, hash-verified

602 handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8'))
603
604 def shutdown_system(self, handler):
605 try:
606 command = "sudo shutdown now"
607 subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
608 handler.send_response(200)
609 handler.send_header("Content-type", "application/json")
610 handler.end_headers()
611 handler.wfile.write(json.dumps({"status": "success", "message": "System is shutting down"}).encode('utf-8'))
612 except subprocess.CalledProcessError as e:
613 handler.send_response(500)
614 handler.send_header("Content-type", "application/json")
615 handler.end_headers()
616 handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8'))
617
618 def restart_ragnar_service(self, handler):
619 try:

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected