103 lines
3.5 KiB
Bash
Executable File
103 lines
3.5 KiB
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
START=49
|
|
STOP=10
|
|
USE_PROCD=1
|
|
|
|
# Configuration paths
|
|
QUEUE_DIR="/tmp/at_queue"
|
|
RESULTS_DIR="$QUEUE_DIR/results"
|
|
LOG_DIR="/www/signal_graphs"
|
|
|
|
start_service() {
|
|
# Ensure required directories exist
|
|
mkdir -p "$QUEUE_DIR" "$RESULTS_DIR" "$LOG_DIR"
|
|
chmod 755 "$QUEUE_DIR" "$RESULTS_DIR" "$LOG_DIR"
|
|
|
|
# Start the AT Command Queue Manager
|
|
echo "Starting AT Command Queue Manager..."
|
|
procd_open_instance
|
|
procd_set_param command /www/cgi-bin/services/at_queue_manager.sh
|
|
procd_set_param respawn
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
echo "AT Queue Manager Started"
|
|
|
|
# Start the Signal Metrics Logger
|
|
echo "Starting Signal Metrics Logger..."
|
|
procd_open_instance
|
|
procd_set_param command /www/cgi-bin/services/log_signal_metrics.sh
|
|
procd_set_param respawn
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
echo "Signal Metrics Logger started"
|
|
|
|
# Start the QCAINFO Interpreter
|
|
echo "Starting QCAINFO Interpreter..."
|
|
procd_open_instance
|
|
procd_set_param command /www/cgi-bin/services/network_insights_interpreter.sh
|
|
procd_set_param respawn
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
echo "QCAINFO Interpreter started"
|
|
|
|
# Start ping daemon if enabled in configuration
|
|
PING_CONFIG_FILE="/etc/quecmanager/settings/ping_settings.conf"
|
|
if [ -f "$PING_CONFIG_FILE" ]; then
|
|
PING_ENABLED=$(awk -F'=' '/^PING_ENABLED=/ {print $2}' "$PING_CONFIG_FILE" 2>/dev/null | tr -d '"' | tr -d ' ')
|
|
echo "Ping config found. PING_ENABLED='$PING_ENABLED'"
|
|
|
|
case "$PING_ENABLED" in
|
|
true|1|on|yes|enabled)
|
|
echo "Starting Ping Daemon..."
|
|
procd_open_instance
|
|
procd_set_param command /www/cgi-bin/services/ping_daemon.sh
|
|
procd_set_param respawn
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
echo "Ping Daemon started"
|
|
;;
|
|
*)
|
|
echo "Ping Daemon disabled in configuration (value: '$PING_ENABLED')"
|
|
;;
|
|
esac
|
|
else
|
|
echo "Ping configuration not found at $PING_CONFIG_FILE, skipping Ping Daemon"
|
|
fi
|
|
|
|
# Start memory daemon if enabled in configuration
|
|
CONFIG_FILE="/etc/quecmanager/settings/memory_settings.conf"
|
|
if [ -f "$CONFIG_FILE" ]; then
|
|
# More robust parsing for OpenWrt/BusyBox
|
|
MEMORY_ENABLED=$(awk -F'=' '/^MEMORY_ENABLED=/ {print $2}' "$CONFIG_FILE" 2>/dev/null | tr -d '"' | tr -d ' ')
|
|
echo "Memory config found. MEMORY_ENABLED='$MEMORY_ENABLED'"
|
|
|
|
case "$MEMORY_ENABLED" in
|
|
true|1|on|yes|enabled)
|
|
echo "Starting Memory Daemon..."
|
|
procd_open_instance
|
|
procd_set_param command /www/cgi-bin/services/memory_daemon.sh
|
|
procd_set_param respawn
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
echo "Memory Daemon started"
|
|
;;
|
|
*)
|
|
echo "Memory Daemon disabled in configuration (value: '$MEMORY_ENABLED')"
|
|
;;
|
|
esac
|
|
else
|
|
echo "Memory configuration not found at $CONFIG_FILE, skipping Memory Daemon"
|
|
fi
|
|
|
|
echo "All QuecManager services Started"
|
|
}
|
|
|
|
stop_service() {
|
|
# procd will handle stopping all instances automatically
|
|
echo "Stopping QuecManager services."
|
|
} |