2019-08-05 20:51:20 +02:00
|
|
|
import logging
|
2021-08-12 18:09:15 +02:00
|
|
|
import os
|
2018-11-01 19:50:04 +01:00
|
|
|
|
2019-08-05 20:51:20 +02:00
|
|
|
import aiohttp
|
2019-01-04 09:29:09 +01:00
|
|
|
|
2018-11-01 19:50:04 +01:00
|
|
|
|
2019-08-05 20:51:20 +02:00
|
|
|
class SystemController:
|
2018-11-01 19:50:04 +01:00
|
|
|
|
2018-11-01 21:25:42 +01:00
|
|
|
def __init__(self, cbpi):
|
|
|
|
self.cbpi = cbpi
|
|
|
|
self.service = cbpi.actor
|
2019-08-05 20:51:20 +02:00
|
|
|
self.logger = logging.getLogger(__name__)
|
2019-07-31 07:58:54 +02:00
|
|
|
|
|
|
|
self.cbpi.app.on_startup.append(self.check_for_update)
|
|
|
|
|
|
|
|
|
|
|
|
async def check_for_update(self, app):
|
2021-02-16 20:37:51 +01:00
|
|
|
pass
|
2019-01-28 22:21:31 +01:00
|
|
|
|
|
|
|
|
2021-08-12 18:09:15 +02:00
|
|
|
async def restart(self):
|
|
|
|
logging.info("RESTART")
|
|
|
|
os.system('systemctl reboot')
|
|
|
|
pass
|
2019-01-28 22:21:31 +01:00
|
|
|
|
2021-08-12 18:09:15 +02:00
|
|
|
async def shutdown(self):
|
|
|
|
logging.info("SHUTDOWN")
|
|
|
|
os.system('systemctl poweroff')
|
|
|
|
pass
|