Added improvements to Speedtest and QuecProfiles
This commit is contained in:
@@ -356,4 +356,4 @@ boot_check() {
|
||||
# Execute main function
|
||||
log_message "====== STARTING BOOT-TIME CELL LOCK CHECK ======" "notice"
|
||||
boot_check
|
||||
log_message "====== COMPLETED BOOT-TIME CELL LOCK CHECK ======" "notice"
|
||||
log_message "====== COMPLETED BOOT-TIME CELL LOCK CHECK ======" "notice"
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# Location: /www/cgi-bin/quecmanager/home/speedtest/speedtest_status.sh
|
||||
|
||||
STATUS_FILE="/tmp/speedtest_status.json"
|
||||
FINAL_RESULT="/tmp/speedtest_final.json"
|
||||
|
||||
echo "Content-Type: application/json"
|
||||
echo "Cache-Control: no-cache, no-store, must-revalidate"
|
||||
echo "Pragma: no-cache"
|
||||
echo "Expires: 0"
|
||||
echo ""
|
||||
|
||||
# Check if the test is completed and we have a final result
|
||||
if [ -f "$FINAL_RESULT" ] && [ -r "$FINAL_RESULT" ] && [ -s "$FINAL_RESULT" ]; then
|
||||
# Return the saved final result
|
||||
cat $FINAL_RESULT
|
||||
elif [ -f "$STATUS_FILE" ]; then
|
||||
# Check if the file is readable and not empty
|
||||
if [ -r "$STATUS_FILE" ] && [ -s "$STATUS_FILE" ]; then
|
||||
# Return current status if test is running
|
||||
cat $STATUS_FILE
|
||||
else
|
||||
# File exists but is empty or not readable
|
||||
echo '{"status": "pending", "message": "Test initializing..."}'
|
||||
fi
|
||||
else
|
||||
# Indicate no active test
|
||||
echo '{"status": "not_running"}'
|
||||
fi
|
||||
@@ -1,10 +1,36 @@
|
||||
#!/bin/sh
|
||||
# /www/cgi-bin/start_speedtest.sh
|
||||
# Location: /www/cgi-bin/quecmanager/home/speedtest/start_speedtest.sh
|
||||
|
||||
STATUS_FILE="/tmp/speedtest_status.json"
|
||||
FINAL_RESULT="/tmp/speedtest_final.json"
|
||||
|
||||
# Set content type header
|
||||
echo "Content-Type: application/json"
|
||||
echo ""
|
||||
|
||||
# Run speedtest in background
|
||||
/www/cgi-bin/quecmanager/home/speedtest/speedtest.sh
|
||||
# Remove any existing status files
|
||||
rm -f $STATUS_FILE
|
||||
rm -f $FINAL_RESULT
|
||||
|
||||
# Immediately return a success response
|
||||
# Initialize status file
|
||||
echo '{"status": "starting"}' > $STATUS_FILE
|
||||
chmod 644 $STATUS_FILE
|
||||
|
||||
# Run speedtest in background and pipe output to status file
|
||||
(
|
||||
export HOME=/tmp/home
|
||||
/usr/bin/speedtest --accept-license -f json -p yes --progress-update-interval=100 | \
|
||||
while IFS= read -r line; do
|
||||
# Update status file with latest JSON data
|
||||
echo "$line" > $STATUS_FILE
|
||||
|
||||
# If this is a result line, also save it as the final result
|
||||
if echo "$line" | grep -q '"type":"result"'; then
|
||||
echo "$line" > $FINAL_RESULT
|
||||
chmod 644 $FINAL_RESULT
|
||||
fi
|
||||
done
|
||||
) &
|
||||
|
||||
# Return immediate success response
|
||||
echo '{"status":"started"}'
|
||||
Reference in New Issue
Block a user