mirror of
https://github.com/BluemediaGER/ScanOS.git
synced 2024-11-14 05:25:29 +01:00
14 lines
319 B
Python
14 lines
319 B
Python
from fastapi import APIRouter
|
|
import subprocess
|
|
|
|
router = APIRouter(prefix="/api/power")
|
|
|
|
@router.post("/shutdown")
|
|
async def power_shutdown():
|
|
subprocess.call(["sudo", "shutdown", "-h", "now"])
|
|
return {}
|
|
|
|
@router.post("/restart")
|
|
async def power_restart():
|
|
subprocess.call(["sudo", "reboot"])
|
|
return {} |