Files
quectel-rgmii-toolkit/ipk-source/sdxpinn-quecmanager-beta/root/etc/init.d/quecwatch
Cameron Thompson 8e80ba5c91 Final edits
- Make all cgi-bin and init files executable

- Move NTP contribution fix from package --> to be appart of sdxpinn-patch

- Edited ntp fi location

- Added additional service triggers to primary service quecmanager-services
2025-03-11 23:39:06 -04:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/sh /etc/rc.common
START=99
STOP=10
USE_PROCD=1
DAEMON="/www/cgi-bin/services/quecwatch.sh"
UCI_CONFIG="quecmanager"
PID_FILE="/var/run/quecwatch.pid"
LOG_DIR="/tmp/log/quecwatch"
start_service() {
# Check if the daemon script exists
if [ ! -x "$DAEMON" ]; then
logger -t quecwatch -p daemon.error "Daemon script not found or not executable: $DAEMON"
return 1
fi
# Check if service is enabled in UCI
local enabled
config_load "$UCI_CONFIG"
config_get_bool enabled quecwatch enabled 0
if [ "$enabled" -ne 1 ]; then
logger -t quecwatch -p daemon.info "QuecWatch service is disabled in config"
return 0
fi
# Create log directory
mkdir -p "$LOG_DIR"
# Start the service via procd
logger -t quecwatch -p daemon.info "Starting QuecWatch daemon"
procd_open_instance "quecwatch"
procd_set_param command "$DAEMON"
procd_set_param respawn 3600 5 5 # Retry every hour, 5 times max
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param pidfile "$PID_FILE"
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "$UCI_CONFIG"
}
reload_service() {
restart
}