[Unit] Description=Air Compressor Gas-Electric Ratio Edge Gateway (EG828-CEW) After=network-online.target Wants=network-online.target [Service] Type=simple WorkingDirectory=/opt/hx-gateway Environment=PYTHONUNBUFFERED=1 ExecStart=/opt/hx-gateway/.venv/bin/python -m gateway.app --config /opt/hx-gateway/config/config.yaml # 串口异常/程序异常自动重启;正常退出码 0 不重启 Restart=always RestartSec=3 KillSignal=SIGTERM TimeoutStopSec=20 # 串口权限(若改用非 root 用户,请将该用户加入 dialout 组) User=root [Install] WantedBy=multi-user.target