Update socat-bridge and QuecManager
Created quecmanager services Removed SMS for now Updated socat start priority and add smd7 as an option
This commit is contained in:
@@ -4,63 +4,8 @@
|
||||
mv /www/index.html /www/index.html.old
|
||||
cp /www/login.html /www/index.html
|
||||
|
||||
# Define the commands to add to rc.local
|
||||
COMMANDS="/www/cgi-bin/settings/change_sms_code.sh
|
||||
/www/cgi-bin/home/log_signal_metrics.sh &"
|
||||
|
||||
# Create a new rc.local with commands correctly placed
|
||||
TMP_RC_LOCAL=$(mktemp)
|
||||
|
||||
awk -v commands="$COMMANDS" '
|
||||
BEGIN {
|
||||
split(commands, cmdArr, "\n") # Split commands into an array
|
||||
for (i in cmdArr) alreadyAdded[cmdArr[i]] = 0
|
||||
added = 0
|
||||
}
|
||||
{
|
||||
if ($0 in alreadyAdded) {
|
||||
alreadyAdded[$0] = 1
|
||||
next
|
||||
}
|
||||
if (/^# the system init finished. By default/) {
|
||||
print
|
||||
if (!added) {
|
||||
for (i in cmdArr) if (!alreadyAdded[cmdArr[i]]) {
|
||||
print cmdArr[i]
|
||||
alreadyAdded[cmdArr[i]] = 1
|
||||
}
|
||||
print ""
|
||||
added = 1
|
||||
}
|
||||
} else {
|
||||
print
|
||||
}
|
||||
}
|
||||
END {
|
||||
# Add any missing commands at the end of the section
|
||||
for (i in cmdArr) if (!alreadyAdded[cmdArr[i]]) print cmdArr[i]
|
||||
}
|
||||
' /etc/rc.local > "$TMP_RC_LOCAL"
|
||||
|
||||
# Replace the original rc.local with the modified one
|
||||
mv "$TMP_RC_LOCAL" /etc/rc.local
|
||||
chmod +x /etc/rc.local
|
||||
|
||||
# Ensure log_signal_metrics.sh is running
|
||||
if ! pgrep -f "/www/cgi-bin/home/log_signal_metrics.sh" > /dev/null; then
|
||||
echo "Starting log_signal_metrics.sh..."
|
||||
/www/cgi-bin/home/log_signal_metrics.sh &
|
||||
else
|
||||
echo "log_signal_metrics.sh is already running. Skipping start."
|
||||
fi
|
||||
|
||||
# Ensure change_sms_code.sh is running
|
||||
if ! pgrep -f "/www/cgi-bin/settings/change_sms_code.sh" > /dev/null; then
|
||||
echo "Starting change_sms_code.sh..."
|
||||
/www/cgi-bin/settings/change_sms_code.sh
|
||||
else
|
||||
echo "change_sms_code.sh is already running. Skipping start."
|
||||
fi
|
||||
service quecmanager-services enable
|
||||
service quecmanager-services start
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ for SCRIPT in $SCRIPTS; do
|
||||
fi
|
||||
done
|
||||
|
||||
service quecmanager-services stop
|
||||
service quecmanager-services disable
|
||||
|
||||
echo "Cleanup complete."
|
||||
exit 0
|
||||
|
||||
|
||||
25
ipk-source/sdxpinn-quecmanager-beta/root/etc/init.d/quecmanager-services
Executable file
25
ipk-source/sdxpinn-quecmanager-beta/root/etc/init.d/quecmanager-services
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=49
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
echo "Starting QuecManager services"
|
||||
echo "Starting Signal Metrics Logger"
|
||||
# Start 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 Running"
|
||||
echo "All QuecManager services Running"
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
# procd will handle stopping all instances automatically
|
||||
echo "Stopping QuecManager services."
|
||||
}
|
||||
@@ -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
|
||||
@@ -1,8 +1,8 @@
|
||||
Package: socat-at-bridge
|
||||
Version: 1.0.1
|
||||
Version: 1.1.0
|
||||
Depends: libc socat
|
||||
Source: github/iamromulan/quectel-rgmii-toolkit
|
||||
Section: utils
|
||||
URL: https://github.com/iamromulan/quectel-rgmii-toolkit
|
||||
Architecture: aarch64_cortex-a53
|
||||
Description: Sets up a tty from SMD11
|
||||
Description: Sets up a tty from SMD11, SMD7 optional
|
||||
|
||||
@@ -4,6 +4,8 @@ echo "Enabling socat-at-bridge at startup"
|
||||
service socat-at-bridge enable
|
||||
echo "Starting socat-at-bridge"
|
||||
service socat-at-bridge start
|
||||
echo "/dev/ttySMD11 is now available"
|
||||
echo "If you want /dev/ttySMD7 as well you can use service socat-at-bridge"
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ echo "Disabling socat-at-bridge at startup"
|
||||
service socat-at-bridge disable
|
||||
echo "Stopping socat-at-bridge"
|
||||
service socat-at-bridge stop
|
||||
service socat-at-bridge-smd7 stop
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
START=30
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
@@ -8,7 +8,7 @@ USE_PROCD=1
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
|
||||
# Start socat to create /dev/ttyIN and /dev/ttyOUT
|
||||
# Start socat to create /dev/ttySMD11IN and /dev/ttySMD11
|
||||
procd_set_param command \
|
||||
socat -d -d pty,link=/dev/ttySMD11IN,raw,echo=0,group=20,perm=660 \
|
||||
pty,link=/dev/ttySMD11,raw,echo=1,group=20,perm=660
|
||||
|
||||
40
ipk-source/socat-at-bridge/root/etc/init.d/socat-at-bridge-smd7
Executable file
40
ipk-source/socat-at-bridge/root/etc/init.d/socat-at-bridge-smd7
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=30
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
|
||||
# Start socat to create /dev/ttySMD7IN and /dev/ttySMD7
|
||||
procd_set_param command \
|
||||
socat -d -d pty,link=/dev/ttySMD7IN,raw,echo=0,group=20,perm=660 \
|
||||
pty,link=/dev/ttySMD7,raw,echo=1,group=20,perm=660
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
|
||||
# Start cat process for /dev/smd11 to /dev/ttySMD11IN
|
||||
procd_open_instance
|
||||
procd_set_param command sh -c "cat /dev/smd7 > /dev/ttySMD7IN"
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
|
||||
# Start cat process for /dev/ttySMD7IN to /dev/smd7
|
||||
procd_open_instance
|
||||
procd_set_param command sh -c "cat /dev/ttySMD7IN > /dev/smd7"
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
# procd will handle stopping all instances automatically
|
||||
echo "Stopping socat and cat instances."
|
||||
}
|
||||
Reference in New Issue
Block a user