#!/bin/bash
# Stop the daemon before uninstall (best effort).
DATA_DIR="${TRIM_PKGVAR:-}"
if [ -n "$DATA_DIR" ] && [ -f "${DATA_DIR}/daemon.pid" ]; then
    pid="$(cat "${DATA_DIR}/daemon.pid" 2>/dev/null)"
    [ -n "$pid" ] && kill "$pid" 2>/dev/null
    rm -f "${DATA_DIR}/daemon.pid"
fi
exit 0
