Files
quectel-rgmii-toolkit/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postinst
Cameron Thompson dcd8cd6ab7 QueManager BETA 1.0.9
- Added Cell Locking Scheduler UI improvements
- Fixed change_sms_code.sh to properly exit
- Added an experimental feature: Keep-alive
- Added disable state for speedtest when keep-alive is active

Co-Authored-By: Russel Yasol <73575327+dr-dolomite@users.noreply.github.com>
2024-12-23 16:33:51 -05:00

67 lines
1.7 KiB
Bash
Executable File

#!/bin/ash
# Backup the original index.html and replace with login.html
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
exit 0