openflexure-microscope-server/openflexure_microscope/api/v2/blueprints/actions/system.py
2019-11-27 16:31:11 +00:00

37 lines
661 B
Python

from openflexure_microscope.api.views import MicroscopeView
import subprocess
class ShutdownAPI(MicroscopeView):
"""
Attempt to shutdown the device
"""
def post(self):
"""
Attempt to shutdown the device
.. :quickref: Actions; Shutdown
"""
subprocess.Popen(["shutdown", "-h", "now"])
return "{}", 201
class RebootAPI(MicroscopeView):
"""
Attempt to reboot the device
"""
def post(self):
"""
Attempt to shutdown the device
.. :quickref: Actions; Shutdown
"""
subprocess.Popen(["shutdown", "-r", "now"])
return "{}", 201