feat(service): implement PID-file based service management
- Add PID directory creation in setup-directories.sh - Update start.sh to use /var/run/furt/furt.pid for both platforms - Fix OpenBSD rc.d script pidfile variable path - Correct systemd service PIDFile parameter path - Resolve rcctl check detection issues on OpenBSD Fixes service detection problems where rcctl check would show (failed) even when service was running. PID-file approach provides reliable cross-platform service status detection instead of fragile pexp patterns. Related DAW/furt#100
This commit is contained in:
parent
7ee990b052
commit
59f372f2b0
4 changed files with 7 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ Type=forking
|
|||
User=furt
|
||||
Group=furt
|
||||
ExecStart=/usr/local/share/furt/scripts/start.sh
|
||||
PIDFile=/var/run/furt.pid
|
||||
PIDFile=/var/run/furt/furt.pid
|
||||
WorkingDirectory=/usr/local/share/furt
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ daemon_cwd="/usr/local/share/furt"
|
|||
. /etc/rc.d/rc.subr
|
||||
|
||||
# PID-File location
|
||||
pidfile="/var/run/furt.pid"
|
||||
pidfile="/var/run/furt/furt.pid"
|
||||
|
||||
# Custom rc_check function (PID-File based)
|
||||
rc_check() {
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@ fi
|
|||
mkdir -p "$CONFIG_DIR"
|
||||
mkdir -p /usr/local/share/furt
|
||||
mkdir -p /var/log/furt
|
||||
mkdir -p /var/run/furt
|
||||
|
||||
# Set ownership for log directory (service user needs write access)
|
||||
chown "$USER:$GROUP" /var/log/furt
|
||||
chown "$USER:$GROUP" /var/run/furt
|
||||
|
||||
echo "Created directories:"
|
||||
echo " Config: $CONFIG_DIR"
|
||||
echo " Share: /usr/local/share/furt"
|
||||
echo " Logs: /var/log/furt (owned by $USER)"
|
||||
echo " PID: /var/run/furt (owned by $USER)"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ LUA_COMMAND=""
|
|||
# Config check first
|
||||
if [ "$(uname)" = "OpenBSD" ] || [ "$(uname)" = "FreeBSD" ]; then
|
||||
CONFIG_FILE="/usr/local/etc/furt/furt.conf"
|
||||
PID_FILE="/var/run/furt.pid"
|
||||
PID_FILE="/var/run/furt/furt.pid"
|
||||
else
|
||||
CONFIG_FILE="/etc/furt/furt.conf"
|
||||
PID_FILE="/var/run/furt.pid"
|
||||
PID_FILE="/var/run/furt/furt.pid"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG_FILE" ] && [ ! -f "$PROJECT_DIR/config/furt.conf" ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue