Files
dell-fans-controller-docker/start.py

30 lines
976 B
Python
Raw Normal View History

2024-05-19 22:38:21 +08:00
import os
import time
import traceback
from controller.client import FanController
from controller.logger import logger
if __name__ == '__main__':
host = "10.10.11.11" #os.getenv('HOST') │
username = "root" #os.getenv('USERNAME') │
password = "ddmabc123" #os.getenv('PASSWORD')
2024-05-19 22:38:21 +08:00
if host is None:
raise RuntimeError('未设置 HOST 环境变量')
2024-05-19 22:38:21 +08:00
if username is None:
raise RuntimeError('未设置 USERNAME 环境变量')
2024-05-19 22:38:21 +08:00
if password is None:
raise RuntimeError('未设置 PASSWORD 环境变量')
2024-05-19 22:38:21 +08:00
while True:
try:
2024-05-19 22:38:21 +08:00
client = FanController(host=host, username=username, password=password)
client.run()
time.sleep(60)
except Exception as err:
logger.error(
2025-06-08 12:50:52 +08:00
f'运行控制器失败 {err}. {traceback.format_exc()}'
)