mirror of
https://github.com/lkddi/dell-fans-controller-docker.git
synced 2026-04-03 18:10:51 +08:00
init commit
This commit is contained in:
31
start.py
Normal file
31
start.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import os
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from controller.client import FanController
|
||||
from controller.logger import logger
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
host = os.getenv('HOST')
|
||||
username = os.getenv('USERNAME')
|
||||
password = os.getenv('PASSWORD')
|
||||
|
||||
if host is None:
|
||||
raise RuntimeError('HOST environment variable not set')
|
||||
|
||||
if username is None:
|
||||
raise RuntimeError('USERNAME environment variable not set')
|
||||
|
||||
if password is None:
|
||||
raise RuntimeError('PASSWORD environment variable not set')
|
||||
|
||||
while True:
|
||||
try:
|
||||
client = FanController(host=host, username=username, password=password)
|
||||
client.run()
|
||||
time.sleep(60)
|
||||
except Exception as err:
|
||||
logger.error(
|
||||
f'run controller failed {err}. {traceback.format_exc()}'
|
||||
)
|
||||
Reference in New Issue
Block a user