mirror of
https://github.com/lkddi/dell-fans-controller-docker.git
synced 2026-04-03 18:10:51 +08:00
32 lines
839 B
Python
32 lines
839 B
Python
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()}'
|
|
)
|