Removed deprecated scripts

This commit is contained in:
Russel Yasol
2025-01-17 15:00:35 +08:00
parent b8f9feef20
commit bae23b5587
3 changed files with 0 additions and 114 deletions

View File

@@ -1,38 +0,0 @@
#!/bin/sh
# handle_sms.sh - CGI script to handle SMS web requests
# Content type declaration for CGI
echo "Content-type: application/json"
echo ""
# 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
# # Fetch all SMS messages and update the JSON file
# Disabled until the atinout bug is fixed
# 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
# Return the contents of the JSON file
if [ -f "/tmp/sms_inbox.json" ]; then
cat /tmp/sms_inbox.json
else
echo '{"error": "SMS inbox file not found"}'
fi

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

View File

@@ -1,38 +0,0 @@
#!/bin/sh
# Set the content type to JSON
echo "Content-Type: application/json"
echo ""
# Configuration file path
CONFIG_FILE="/etc/quecManager.conf"
# Check if the config file exists
if [ ! -f "$CONFIG_FILE" ]; then
echo '{"error": "Configuration file not found"}'
exit 1
fi
# Initialize variables
AT_PORT=""
AT_PORT_CUSTOM=""
DATA_REFRESH_RATE=""
# Read the config file line by line and extract values
while IFS='=' read -r key value; do
# Remove leading/trailing whitespace
key=$(echo "$key" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
value=$(echo "$value" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
case "$key" in
"AT_port") AT_PORT="$value" ;;
"AT_port_custom") AT_PORT_CUSTOM="$value" ;;
"data_refresh_rate") DATA_REFRESH_RATE="$value" ;;
esac
done <"$CONFIG_FILE"
# Output JSON
echo "{"
echo " \"AT_port\": \"$AT_PORT\","
echo " \"AT_port_custom\": \"$AT_PORT_CUSTOM\","
echo " \"data_refresh_rate\": $DATA_REFRESH_RATE"
echo "}"