Merging Beta 2.0.0 Release Candidate
This commit is contained in:
22
ipk-source/sdxpinn-quecmanager-beta/root/etc/init.d/ntp.init
Normal file
22
ipk-source/sdxpinn-quecmanager-beta/root/etc/init.d/ntp.init
Normal file
@@ -0,0 +1,22 @@
|
||||
#! /bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
if [ ! -f /etc/config/system ]; then
|
||||
touch /etc/config/system
|
||||
|
||||
sh /etc/init.d/ntp.config.h
|
||||
procd_open_instance
|
||||
procd_set_param command user ntp
|
||||
procd_set_param command group ntp
|
||||
procd_close_instance
|
||||
fi
|
||||
echo "Starting ntp config service..."
|
||||
}
|
||||
|
||||
stop_service(){
|
||||
echo "Stoping ntp config service..."
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=95
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
DAEMON="/www/cgi-bin/services/scheduled_cell_locking.sh"
|
||||
UCI_CONFIG="quecmanager"
|
||||
PID_FILE="/var/run/cell_lock_scheduler.pid"
|
||||
LOG_DIR="/tmp/log/cell_lock"
|
||||
|
||||
start_service() {
|
||||
# Check if the daemon script exists
|
||||
if [ ! -x "$DAEMON" ]; then
|
||||
logger -t cell_lock -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 cell_lock enabled 0
|
||||
|
||||
if [ "$enabled" -ne 1 ]; then
|
||||
logger -t cell_lock -p daemon.info "Cell lock scheduler is disabled in config"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Create log directory
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
# Start the service via procd
|
||||
logger -t cell_lock -p daemon.info "Starting cell lock scheduler daemon"
|
||||
procd_open_instance "cell_lock_scheduler"
|
||||
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
|
||||
}
|
||||
@@ -3,25 +3,27 @@ START=49
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
# Run clear_logs.sh once without procd management, with a timeout
|
||||
echo "Clearing QuecManager Logs"
|
||||
timeout 5 /www/cgi-bin/services/clear_logs.sh
|
||||
if [ $? -eq 124 ]; then
|
||||
echo "clear_logs.sh timed out after 5 seconds"
|
||||
else
|
||||
echo "Log Cleaner complete"
|
||||
fi
|
||||
# Configuration paths
|
||||
QUEUE_DIR="/tmp/at_queue"
|
||||
RESULTS_DIR="$QUEUE_DIR/results"
|
||||
LOG_DIR="/www/signal_graphs"
|
||||
|
||||
# Start the continuously running services
|
||||
echo "Starting AT Command Queue Processor..."
|
||||
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_processor.sh
|
||||
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 Processor Started"
|
||||
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
|
||||
@@ -37,4 +39,4 @@ start_service() {
|
||||
stop_service() {
|
||||
# procd will handle stopping all instances automatically
|
||||
echo "Stopping QuecManager services."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=99
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
# Configuration paths
|
||||
PROG="/www/cgi-bin/services/quecprofile.sh"
|
||||
CONF="/etc/config/quecprofiles"
|
||||
TRACK_FILE="/tmp/quecprofiles_active"
|
||||
CHECK_TRIGGER="/tmp/quecprofiles_check"
|
||||
STATUS_FILE="/tmp/quecprofiles_status.json"
|
||||
DEBUG_LOG="/tmp/quecprofiles_debug.log"
|
||||
|
||||
start_service() {
|
||||
# Ensure configuration exists
|
||||
if [ ! -f "$CONF" ]; then
|
||||
# Create default configuration
|
||||
cat > "$CONF" <<-EOF
|
||||
config quecprofiles 'settings'
|
||||
option check_interval '60'
|
||||
option enable_autoswitch '1'
|
||||
option apply_priority '20'
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Ensure script is executable
|
||||
if [ -f "$PROG" ]; then
|
||||
chmod 755 "$PROG"
|
||||
else
|
||||
logger -t quecprofiles -p daemon.error "Profile daemon script not found at $PROG"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Clear any existing logs
|
||||
echo "$(date) - Init script starting service" > "$DEBUG_LOG"
|
||||
|
||||
# Check if service is enabled
|
||||
local enabled
|
||||
config_load quecprofiles
|
||||
config_get_bool enabled settings enable_autoswitch 1
|
||||
|
||||
if [ "$enabled" -eq 0 ]; then
|
||||
logger -t quecprofiles -p daemon.info "QuecProfiles service is disabled in config"
|
||||
echo "$(date) - Service is disabled in config" >> "$DEBUG_LOG"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Log before starting daemon
|
||||
logger -t quecprofiles -p daemon.info "Starting QuecProfiles Daemon with script: $PROG"
|
||||
echo "$(date) - Starting daemon using script: $PROG" >> "$DEBUG_LOG"
|
||||
|
||||
# Start the profile daemon
|
||||
echo "Starting QuecProfiles Daemon..."
|
||||
procd_open_instance "quecprofiles"
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
echo "QuecProfiles Daemon Started"
|
||||
echo "$(date) - Daemon started via procd" >> "$DEBUG_LOG"
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
# Clean up state files
|
||||
rm -f "$TRACK_FILE"
|
||||
rm -f "$CHECK_TRIGGER"
|
||||
|
||||
# Log stop action
|
||||
logger -t quecprofiles -p daemon.info "Stopping QuecProfiles service"
|
||||
echo "$(date) - Stopping service" >> "$DEBUG_LOG"
|
||||
|
||||
# procd will handle stopping the instance automatically
|
||||
echo "Stopping QuecProfiles service."
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "quecprofiles"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
touch "$CHECK_TRIGGER"
|
||||
restart
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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
|
||||
}
|
||||
Reference in New Issue
Block a user