Fixed QuecManager Services and removed deprecated change_sms script.

This commit is contained in:
Russel Yasol
2025-01-18 06:46:00 +08:00
parent a7365470f8
commit f0121bcb4a
3 changed files with 8 additions and 86 deletions

View File

@@ -1,12 +1,15 @@
#!/bin/sh /etc/rc.common
START=99
START=49
STOP=10
USE_PROCD=1
start_service() {
# echo "Starting QuecManager services"
# Run clear_logs.sh once without procd management
echo "Running clear_logs.sh"
/www/cgi-bin/services/clear_logs.sh
echo "clear_logs.sh complete"
# Start the continuously running services
procd_open_instance
procd_set_param command /www/cgi-bin/services/log_signal_metrics.sh
procd_set_param respawn
@@ -21,12 +24,6 @@ start_service() {
procd_set_param stderr 1
procd_close_instance
procd_open_instance
procd_set_param command /www/cgi-bin/services/clear_logs.sh
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
echo "Signal Metrics Logger Running"
echo "All QuecManager services Running"
}
@@ -34,4 +31,4 @@ start_service() {
stop_service() {
# procd will handle stopping all instances automatically
echo "Stopping QuecManager services."
}
}

View File

@@ -1,37 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
STOP=10
USE_PROCD=1
start_service() {
# echo "Starting QuecManager services"
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
procd_open_instance
procd_set_param command /www/cgi-bin/services/at_queue_processor.sh
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
procd_open_instance
procd_set_param command /www/cgi-bin/services/clear_logs.sh
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
echo "Signal Metrics Logger Running"
echo "All QuecManager services Running"
}
stop_service() {
# procd will handle stopping all instances automatically
echo "Stopping QuecManager services."
}

View File

@@ -1,38 +0,0 @@
#!/bin/sh
# Script for SMS initialization and initial fetch
# Check if atinout and jq are installed
if ! command -v atinout &> /dev/null || ! command -v jq &> /dev/null; then
echo "Error: Required tools (atinout or jq) are not installed"
exit 1
fi
# Check if the device exists
if [ ! -c "/dev/smd7" ]; then
echo "Error: Device /dev/smd7 not found"
exit 1
fi
# Set SMS text mode
if ! echo "AT+CMGF=1" | atinout - /dev/smd7 -; then
echo "Error: Failed to set SMS text mode"
exit 1
fi
# Wait for 2 seconds
sleep 2
# Fetch initial SMS messages
if ! echo "AT+CMGL=\"ALL\"" | atinout - /dev/smd7 - | jq -R -s '
split("\n") |
map(select(length > 0)) |
map(
select(startswith("+CMGL:") or (. != "OK" and . != "ERROR"))
) |
{messages: .}
' > /tmp/sms_inbox.json; then
echo "Error: Failed to fetch SMS messages"
exit 1
fi
# Exit successfully
exit 0