#!/bin/sh
set -e

if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
    # SIGTERM, which main.rs handles: stop accepting, drain in-flight requests,
    # let the cast-check worker finish its tick. TimeoutStopSec in the unit gives
    # it 30 s before systemd escalates.
    deb-systemd-invoke stop jray-server.service >/dev/null || true
fi

exit 0
