#! /bin/bash

cleanup() {
  echo "cleanup()"
  echo "terminating ${FANCTRL_PID}"
  kill -TERM "${FANCTRL_PID}"
}

trap cleanup exit

cd /home/pi/git/fanctrl
exec /home/pi/.local/bin/uv run ./fanctrl.py &
FANCTRL_PID=$!
echo "FANCTRL_PID=${FANCTRL_PID}"
wait "${FANCTRL_PID}"
