[Unit] Description=Yaris OBD/GPS tracker web UI After=network-online.target Wants=network-online.target [Service] Type=simple User=yaris Group=yaris WorkingDirectory=/home/yaris/app/yaris-obd # Unbuffered stdout so print() diagnostics (GPS/GNSS status, etc.) actually reach # the log file promptly instead of sitting in Python's stdout buffer indefinitely # when it's redirected to a file instead of a TTY. Environment=PYTHONUNBUFFERED=1 # Once OBD is confirmed working on this car, pin the protocol to skip the # 3-5s auto-detect probe on every ignition-on: e.g. OBD_PROTOCOL=6 for # ISO 15765-4 CAN 11-bit 500kbps (correct for 2013 Toyota Yaris). # Leave unset during initial setup so auto-detect can find the right value. #Environment=OBD_PROTOCOL=6 ExecStart=/home/yaris/app/yaris-obd/venv/bin/python app.py Restart=on-failure RestartSec=5 # Give the app a few seconds after boot for USB/serial devices to enumerate # before the first connection attempt - it retries gracefully either way, # but this avoids needless noisy "no connection" logs on every cold boot. ExecStartPre=/bin/sleep 5 StandardOutput=append:/home/yaris/app/yaris-obd/yaris-obd.log StandardError=append:/home/yaris/app/yaris-obd/yaris-obd.log [Install] WantedBy=multi-user.target