Added fix for memory fetching initialization

This commit is contained in:
Russel Yasol
2025-08-24 22:01:46 +08:00
parent e2ea01f64a
commit 5ed245a3df
109 changed files with 301 additions and 363 deletions

View File

@@ -53,8 +53,31 @@ start_service() {
procd_close_instance
echo "Ping Daemon started"
# Memory daemon is now managed dynamically by memory_settings.sh
# It will be added/removed from this file automatically based on user configuration
# 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"
}