2025-06-23 19:44:21 +02:00
|
|
|
#!/bin/ksh
|
|
|
|
|
|
2025-09-02 21:24:52 +02:00
|
|
|
daemon="/usr/local/share/furt/scripts/start.sh"
|
2025-06-23 19:44:21 +02:00
|
|
|
daemon_user="_furt"
|
2025-09-02 21:24:52 +02:00
|
|
|
daemon_cwd="/usr/local/share/furt"
|
2025-06-23 19:44:21 +02:00
|
|
|
|
|
|
|
|
. /etc/rc.d/rc.subr
|
|
|
|
|
|
2025-09-05 22:30:07 +02:00
|
|
|
# PID-File location
|
2025-09-07 16:57:35 +02:00
|
|
|
pidfile="/var/run/furt/furt.pid"
|
2025-09-05 22:30:07 +02:00
|
|
|
|
|
|
|
|
# Custom rc_check function (PID-File based)
|
|
|
|
|
rc_check() {
|
|
|
|
|
[ -f "$pidfile" ] && kill -0 $(cat "$pidfile") 2>/dev/null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Custom rc_stop function (PID-File based)
|
|
|
|
|
rc_stop() {
|
|
|
|
|
if [ -f "$pidfile" ]; then
|
|
|
|
|
local _pid=$(cat "$pidfile")
|
|
|
|
|
echo "Stopping furt (PID: $_pid)"
|
|
|
|
|
kill "$_pid" 2>/dev/null
|
|
|
|
|
# Wait for process to die
|
|
|
|
|
local _timeout=10
|
|
|
|
|
while [ $_timeout -gt 0 ] && kill -0 "$_pid" 2>/dev/null; do
|
|
|
|
|
sleep 1
|
|
|
|
|
_timeout=$((_timeout - 1))
|
|
|
|
|
done
|
|
|
|
|
# Force kill if still running
|
|
|
|
|
if kill -0 "$_pid" 2>/dev/null; then
|
|
|
|
|
echo "Force killing furt (PID: $_pid)"
|
|
|
|
|
kill -9 "$_pid" 2>/dev/null
|
|
|
|
|
fi
|
|
|
|
|
rm -f "$pidfile"
|
|
|
|
|
echo "furt stopped"
|
|
|
|
|
else
|
|
|
|
|
echo "furt not running (no PID-File)"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Custom rc_reload function (signal-based)
|
|
|
|
|
rc_reload() {
|
|
|
|
|
if rc_check; then
|
|
|
|
|
local _pid=$(cat "$pidfile")
|
|
|
|
|
echo "Reloading furt configuration (PID: $_pid)"
|
|
|
|
|
kill -HUP "$_pid"
|
|
|
|
|
else
|
|
|
|
|
echo "furt not running"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
2025-06-23 19:44:21 +02:00
|
|
|
|
|
|
|
|
rc_cmd $1
|
|
|
|
|
|