dev #1
@ -62,6 +62,7 @@ adb shell
|
|||||||
cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://code.060070.xyz/sky/simple-admin/raw/branch/main/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh && cd /
|
cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://code.060070.xyz/sky/simple-admin/raw/branch/main/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh && cd /
|
||||||
```
|
```
|
||||||
**您应该看到:**
|
**您应该看到:**
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Tailscale安装和配置
|
## Tailscale安装和配置
|
||||||
|
|||||||
@ -456,15 +456,17 @@ uninstall_simpleadmin_components() {
|
|||||||
tailscale_menu() {
|
tailscale_menu() {
|
||||||
while true; do
|
while true; do
|
||||||
echo -e "\e[1;32mTailscale Menu\e[0m"
|
echo -e "\e[1;32mTailscale Menu\e[0m"
|
||||||
echo -e "\e[1;32m1) Install/Update Tailscale\e[0m"
|
echo -e "\e[1;32m1) Install/Update Tailscale\e[0m"
|
||||||
echo -e "\e[1;36m2) Configure Tailscale\e[0m"
|
echo -e "\e[1;36m2) Configure Tailscale\e[0m"
|
||||||
echo -e "\e[1;31m3) Return to Main Menu\e[0m"
|
echo -e "\e[1;31m3) Uninstall Tailscale\e[0m"
|
||||||
|
echo -e "\e[1;93m4) Return to Main Menu\e[0m"
|
||||||
read -p "Enter your choice: " tailscale_choice
|
read -p "Enter your choice: " tailscale_choice
|
||||||
|
|
||||||
case $tailscale_choice in
|
case $tailscale_choice in
|
||||||
1) install_update_tailscale;;
|
1) install_update_tailscale;;
|
||||||
2) configure_tailscale;;
|
2) configure_tailscale;;
|
||||||
3) break;;
|
3) uninstall_tailscale;;
|
||||||
|
4) break;;
|
||||||
*) echo "Invalid option";;
|
*) echo "Invalid option";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -472,16 +474,47 @@ tailscale_menu() {
|
|||||||
|
|
||||||
# Function to install, update, or remove Tailscale
|
# Function to install, update, or remove Tailscale
|
||||||
install_update_tailscale() {
|
install_update_tailscale() {
|
||||||
echo -e "\e[1;31m2) Installing tailscale from the $GITTREE branch\e[0m"
|
echo -e "\e[1;31m2) Installing tailscale from the $GITTREE branch\e[0m"
|
||||||
ensure_entware_installed
|
ensure_entware_installed
|
||||||
mkdir /usrdata/simpleupdates > /dev/null 2>&1
|
mkdir /usrdata/simpleupdates > /dev/null 2>&1
|
||||||
mkdir /usrdata/simpleupdates/scripts > /dev/null 2>&1
|
mkdir /usrdata/simpleupdates/scripts > /dev/null 2>&1
|
||||||
wget -O /usrdata/simpleupdates/scripts/update_tailscale.sh $GITROOT/simpleupdates/scripts/update_tailscale.sh && chmod +x /usrdata/simpleupdates/scripts/update_tailscale.sh
|
wget -O /usrdata/simpleupdates/scripts/update_tailscale.sh $GITROOT/simpleupdates/scripts/update_tailscale.sh && chmod +x /usrdata/simpleupdates/scripts/update_tailscale.sh
|
||||||
echo -e "\e[1;32mInstalling/updating: Tailscale\e[0m"
|
echo -e "\e[1;32mInstalling/updating: Tailscale\e[0m"
|
||||||
echo -e "\e[1;32mPlease Wait....\e[0m"
|
echo -e "\e[1;32mPlease Wait....\e[0m"
|
||||||
remount_rw
|
remount_rw
|
||||||
/usrdata/simpleupdates/scripts/update_tailscale.sh
|
/usrdata/simpleupdates/scripts/update_tailscale.sh
|
||||||
echo -e "\e[1;32m Tailscale has been updated/installed.\e[0m"
|
echo -e "\e[1;32m Tailscale has been updated/installed.\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to uninstall Tailscale
|
||||||
|
uninstall_tailscale() {
|
||||||
|
echo -e "\e[1;31mUninstalling Tailscale...\e[0m"
|
||||||
|
|
||||||
|
# Stop and logout from Tailscale
|
||||||
|
if [ -f "/usrdata/tailscale/tailscale" ]; then
|
||||||
|
/usrdata/tailscale/tailscale logout
|
||||||
|
/usrdata/tailscale/tailscale down
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop services
|
||||||
|
systemctl stop tailscale 2>/dev/null
|
||||||
|
systemctl stop tailscale-webui 2>/dev/null
|
||||||
|
|
||||||
|
# Remove service files
|
||||||
|
rm -f /lib/systemd/system/tailscale.service
|
||||||
|
rm -f /lib/systemd/system/tailscale-webui.service
|
||||||
|
rm -f /lib/systemd/system/tailscale-webui-trigger.service
|
||||||
|
rm -f /lib/systemd/system/multi-user.target.wants/tailscale-webui-trigger.service
|
||||||
|
|
||||||
|
# Remove Tailscale files and directories
|
||||||
|
rm -rf /usrdata/tailscale
|
||||||
|
rm -f /bin/tailscale
|
||||||
|
rm -f /bin/tailscaled
|
||||||
|
|
||||||
|
# Reload systemd
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
echo -e "\e[1;32mTailscale has been uninstalled.\e[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to Configure Tailscale
|
# Function to Configure Tailscale
|
||||||
@ -768,65 +801,28 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
echo " .%+: "
|
echo "//////////////////////////////////////////////////////////////////";
|
||||||
echo " .*@@@-. "
|
echo "// //";
|
||||||
echo " :@@@@- "
|
echo "// //";
|
||||||
echo " @@@@#. "
|
echo "// :'######::'####:'##::::'##:'########::'##:::::::'########: //";
|
||||||
echo " -@@@@#. "
|
echo "// '##... ##:. ##:: ###::'###: ##.... ##: ##::::::: ##.....:: //";
|
||||||
echo " :. %@@@@: -# "
|
echo "// ##:::..::: ##:: ####'####: ##:::: ##: ##::::::: ##::::::: //";
|
||||||
echo " .+- #@@@@%.+@- "
|
echo "// . ######::: ##:: ## ### ##: ########:: ##::::::: ######::: //";
|
||||||
echo " .#- . +@@@@# #@- "
|
echo "// :..... ##:: ##:: ##. #: ##: ##.....::: ##::::::: ##...:::: //";
|
||||||
echo " -@*@*@% @@@@@::@@= "
|
echo "// '##::: ##:: ##:: ##:.:: ##: ##:::::::: ##::::::: ##::::::: //";
|
||||||
echo ".+%@@@@@@@@@%=. =@@@@# #@@- .. "
|
echo "// . ######::'####: ##:::: ##: ##:::::::: ########: ########: //";
|
||||||
echo " .@@@@@: :@@@@@ =@@@..%= "
|
echo "// :......:::....::..:::::..::..:::::::::........::........:: //";
|
||||||
echo " -::@-.+. @@@@@.=@@@- =@- "
|
echo "// :::'###::::'########::'##::::'##:'####:'##::: ##: //";
|
||||||
echo " .@- .@@@@@:.@@@* @@. "
|
echo "// ::'## ##::: ##.... ##: ###::'###:. ##:: ###:: ##: //";
|
||||||
echo " .%- -@@@@@:=@@@@ @@# "
|
echo "// :'##:. ##:: ##:::: ##: ####'####:: ##:: ####: ##: //";
|
||||||
echo " .#- .%@@@@@@#. +@@@@@.#@@@@ @@@."
|
echo "// '##:::. ##: ##:::: ##: ## ### ##:: ##:: ## ## ##: //";
|
||||||
echo " .*- .@@@@@@@@@@=. @@@@@@ @@@@@ @@@:"
|
echo "// #########: ##:::: ##: ##. #: ##:: ##:: ##. ####: //";
|
||||||
echo " :. .%@@@@@@@@@@@%. .@@@@@+:@@@@@ @@@-"
|
echo "// ##.... ##: ##:::: ##: ##:.:: ##:: ##:: ##:. ###: //";
|
||||||
echo " -@@@@@@@@@@@@@@@..@@@@@@.-@@@@@ .@@@-"
|
echo "// ##:::: ##: ########:: ##:::: ##:'####: ##::. ##: //";
|
||||||
echo " -@@@@@@@@@@%. .@@@@@@. @@@@@+ =@@@="
|
echo "// ..:::::..::........:::..:::::..::....::..::::..:: //";
|
||||||
echo " =@@@@@@@@* .@@@@@@. @@@@@@..@@@@-"
|
echo "// //";
|
||||||
echo " #@@@@@@@@-*@@@@@%..@@@@@@+ #@@@@-"
|
echo "// By iamromulan //";
|
||||||
echo " @@@@@@:.-@@@@@@. @@@@@@= %@@@@@."
|
echo "//////////////////////////////////////////////////////////////////";
|
||||||
echo " .@@@@. *@@@@@@- .+@@@@@@-.@@@@@@+ "
|
|
||||||
echo " %@@. =@@@@@*. +@@@@@@%.-@@@@@@% "
|
|
||||||
echo " .@@ .@@@@@= :@@@@@@@@..@@@@@@@= "
|
|
||||||
echo " =@.+@@@@@. -@@@@@@@*.:@@@@@@@*. "
|
|
||||||
echo " %.*@@@@= .@@@@@@@-.:@@@@@@@+. "
|
|
||||||
echo " ..@@@@= .@@@@@@: #@@@@@@@: "
|
|
||||||
echo " .@@@@ +@@@@..%@@@@@+. "
|
|
||||||
echo " .@@@. @@@@.:@@@@+. "
|
|
||||||
echo " @@@. @@@. @@@* .@. "
|
|
||||||
echo " :@@@ %@@..@@#. *@ "
|
|
||||||
echo " -*: .@@* :@@. @@. -..@@ "
|
|
||||||
echo " =@@@@@@.*@- :@% @* =@:=@# "
|
|
||||||
echo " .@@@-+@@@@:%@..%- ...@%:@@: "
|
|
||||||
echo " .@@. @@-%@: .%@@*@@%. "
|
|
||||||
echo " :@@ :+ *@ *@@#*@@@. "
|
|
||||||
echo " =@@@.@@@@ "
|
|
||||||
echo " .*@@@:=@@@@: "
|
|
||||||
echo " .@@@@:.@@@@@: "
|
|
||||||
echo " .@@@@#.-@@@@@. "
|
|
||||||
echo " #@@@@: =@@@@@- "
|
|
||||||
echo " .@@@@@..@@@@@@* "
|
|
||||||
echo " -@@@@@. @@@@@@#. "
|
|
||||||
echo " -@@@@@ @@@@@@% "
|
|
||||||
echo " @@@@@. #@@@@@@. "
|
|
||||||
echo " :@@@@# =@@@@@@% "
|
|
||||||
echo " @@@@@: @@@@@@@: "
|
|
||||||
echo " *@@@@ @@@@@@@. "
|
|
||||||
echo " .@@@@ @@@@@@@ "
|
|
||||||
echo " #@@@. @@@@@@* "
|
|
||||||
echo " @@@# @@@@@@@ "
|
|
||||||
echo " .@@+=@@@@@@. "
|
|
||||||
echo " *@@@@@@ "
|
|
||||||
echo " :@@@@@= "
|
|
||||||
echo " .@@@@@@. "
|
|
||||||
echo " :@@@@@*. "
|
|
||||||
echo " .=@@@@@- "
|
|
||||||
echo " :+##+. "
|
|
||||||
|
|
||||||
echo -e "\e[92m"
|
echo -e "\e[92m"
|
||||||
echo "Welcome to iamromulan's RGMII Toolkit script for Quectel RMxxx Series modems!"
|
echo "Welcome to iamromulan's RGMII Toolkit script for Quectel RMxxx Series modems!"
|
||||||
|
|||||||
1039
RMxxx_rgmii_toolkit_dev.sh
Normal file
1039
RMxxx_rgmii_toolkit_dev.sh
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,89 +11,35 @@ else
|
|||||||
firmware_revision="UNKNOWN"
|
firmware_revision="UNKNOWN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "=============================================================="
|
|
||||||
# Start your Actual echo output here, 17 lines omitted for mobile compatibility. ttyd font needs to be size 25.
|
# Start your Actual echo output here, 17 lines omitted for mobile compatibility. ttyd font needs to be size 25.
|
||||||
# Echo "Logo"
|
# Echo "Logo"
|
||||||
echo " .%+: "
|
echo "//////////////////////////////////////////////////////////////////";
|
||||||
echo " .*@@@-. "
|
echo "// //";
|
||||||
echo " :@@@@- "
|
echo "// //";
|
||||||
echo " @@@@#. "
|
echo "// :'######::'####:'##::::'##:'########::'##:::::::'########: //";
|
||||||
echo " -@@@@#. "
|
echo "// '##... ##:. ##:: ###::'###: ##.... ##: ##::::::: ##.....:: //";
|
||||||
echo " :. %@@@@: -# "
|
echo "// ##:::..::: ##:: ####'####: ##:::: ##: ##::::::: ##::::::: //";
|
||||||
echo " .+- #@@@@%.+@- "
|
echo "// . ######::: ##:: ## ### ##: ########:: ##::::::: ######::: //";
|
||||||
echo " .#- . +@@@@# #@- "
|
echo "// :..... ##:: ##:: ##. #: ##: ##.....::: ##::::::: ##...:::: //";
|
||||||
echo " -@*@*@% @@@@@::@@= "
|
echo "// '##::: ##:: ##:: ##:.:: ##: ##:::::::: ##::::::: ##::::::: //";
|
||||||
echo ".+%@@@@@@@@@%=. =@@@@# #@@- .. "
|
echo "// . ######::'####: ##:::: ##: ##:::::::: ########: ########: //";
|
||||||
echo " .@@@@@: :@@@@@ =@@@..%= "
|
echo "// :......:::....::..:::::..::..:::::::::........::........:: //";
|
||||||
echo " -::@-.+. @@@@@.=@@@- =@- "
|
echo "// :::'###::::'########::'##::::'##:'####:'##::: ##: //";
|
||||||
echo " .@- .@@@@@:.@@@* @@. "
|
echo "// ::'## ##::: ##.... ##: ###::'###:. ##:: ###:: ##: //";
|
||||||
echo " .%- -@@@@@:=@@@@ @@# "
|
echo "// :'##:. ##:: ##:::: ##: ####'####:: ##:: ####: ##: //";
|
||||||
echo " .#- .%@@@@@@#. +@@@@@.#@@@@ @@@."
|
echo "// '##:::. ##: ##:::: ##: ## ### ##:: ##:: ## ## ##: //";
|
||||||
echo " .*- .@@@@@@@@@@=. @@@@@@ @@@@@ @@@:"
|
echo "// #########: ##:::: ##: ##. #: ##:: ##:: ##. ####: //";
|
||||||
echo " :. .%@@@@@@@@@@@%. .@@@@@+:@@@@@ @@@-"
|
echo "// ##.... ##: ##:::: ##: ##:.:: ##:: ##:: ##:. ###: //";
|
||||||
echo " -@@@@@@@@@@@@@@@..@@@@@@.-@@@@@ .@@@-"
|
echo "// ##:::: ##: ########:: ##:::: ##:'####: ##::. ##: //";
|
||||||
echo " -@@@@@@@@@@%. .@@@@@@. @@@@@+ =@@@="
|
echo "// ..:::::..::........:::..:::::..::....::..::::..:: //";
|
||||||
echo " =@@@@@@@@* .@@@@@@. @@@@@@..@@@@-"
|
echo "// //";
|
||||||
echo " #@@@@@@@@-*@@@@@%..@@@@@@+ #@@@@-"
|
echo "// By iamromulan //";
|
||||||
echo " @@@@@@:.-@@@@@@. @@@@@@= %@@@@@."
|
echo "//////////////////////////////////////////////////////////////////";
|
||||||
echo " .@@@@. *@@@@@@- .+@@@@@@-.@@@@@@+ "
|
echo "==================================================================="
|
||||||
echo " %@@. =@@@@@*. +@@@@@@%.-@@@@@@% "
|
|
||||||
echo " .@@ .@@@@@= :@@@@@@@@..@@@@@@@= "
|
|
||||||
echo " =@.+@@@@@. -@@@@@@@*.:@@@@@@@*. "
|
|
||||||
echo " %.*@@@@= .@@@@@@@-.:@@@@@@@+. "
|
|
||||||
echo " ..@@@@= .@@@@@@: #@@@@@@@: "
|
|
||||||
echo " .@@@@ +@@@@..%@@@@@+. "
|
|
||||||
echo " .@@@. @@@@.:@@@@+. "
|
|
||||||
echo " @@@. @@@. @@@* .@. "
|
|
||||||
echo " :@@@ %@@..@@#. *@ "
|
|
||||||
echo " -*: .@@* :@@. @@. -..@@ "
|
|
||||||
echo " =@@@@@@.*@- :@% @* =@:=@# "
|
|
||||||
echo " .@@@-+@@@@:%@..%- ...@%:@@: "
|
|
||||||
echo " .@@. @@-%@: .%@@*@@%. "
|
|
||||||
echo " :@@ :+ *@ *@@#*@@@. "
|
|
||||||
echo " =@@@.@@@@ "
|
|
||||||
echo " .*@@@:=@@@@: "
|
|
||||||
echo " .@@@@:.@@@@@: "
|
|
||||||
echo " .@@@@#.-@@@@@. "
|
|
||||||
echo " #@@@@: =@@@@@- "
|
|
||||||
echo " .@@@@@..@@@@@@* "
|
|
||||||
echo " -@@@@@. @@@@@@#. "
|
|
||||||
echo " -@@@@@ @@@@@@% "
|
|
||||||
echo " @@@@@. #@@@@@@. "
|
|
||||||
echo " :@@@@# =@@@@@@% "
|
|
||||||
echo " @@@@@: @@@@@@@: "
|
|
||||||
echo " *@@@@ @@@@@@@. "
|
|
||||||
echo " .@@@@ @@@@@@@ "
|
|
||||||
echo " #@@@. @@@@@@* "
|
|
||||||
echo " @@@# @@@@@@@ "
|
|
||||||
echo " .@@+=@@@@@@. "
|
|
||||||
echo " *@@@@@@ "
|
|
||||||
echo " :@@@@@= "
|
|
||||||
echo " .@@@@@@. "
|
|
||||||
echo " :@@@@@*. "
|
|
||||||
echo " .=@@@@@- "
|
|
||||||
echo " :+##+. "
|
|
||||||
echo "=============================================================="
|
|
||||||
echo "TTYd session file by iamromulan v1.1"
|
echo "TTYd session file by iamromulan v1.1"
|
||||||
echo "Firmware Revision: $firmware_revision"
|
echo "Firmware Revision: $firmware_revision"
|
||||||
echo "Serial Number: $serial_number"
|
echo "Serial Number: $serial_number"
|
||||||
echo "=============================================================="
|
echo "==================================================================="
|
||||||
|
|
||||||
# Start a login session
|
# Start a login session
|
||||||
exec /bin/login
|
exec /bin/login
|
||||||
|
|||||||
41
simpleadmin/www/cgi-bin/get_system_stats
Normal file
41
simpleadmin/www/cgi-bin/get_system_stats
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Send HTTP header for plain text content
|
||||||
|
echo "Content-Type: text/plain"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Read first CPU statistics
|
||||||
|
read cpu user nice system idle iowait irq softirq steal guest guest_nice < /proc/stat
|
||||||
|
|
||||||
|
# Record first total usage time and idle time
|
||||||
|
prev_total=$((user+nice+system+idle+iowait+irq+softirq+steal))
|
||||||
|
prev_idle=$idle
|
||||||
|
|
||||||
|
# Wait for a short time to capture CPU usage
|
||||||
|
sleep 0.5
|
||||||
|
|
||||||
|
# Read second CPU statistics
|
||||||
|
read cpu user nice system idle iowait irq softirq steal guest guest_nice < /proc/stat
|
||||||
|
|
||||||
|
# Calculate second total usage time
|
||||||
|
total=$((user+nice+system+idle+iowait+irq+softirq+steal))
|
||||||
|
idle=$idle
|
||||||
|
|
||||||
|
# Calculate time differences
|
||||||
|
total_diff=$((total-prev_total))
|
||||||
|
idle_diff=$((idle-prev_idle))
|
||||||
|
|
||||||
|
# Calculate CPU usage percentage
|
||||||
|
cpu_usage=$(awk -v total_diff="$total_diff" -v idle_diff="$idle_diff" 'BEGIN{printf "%.1f", (total_diff-idle_diff)*100/total_diff}')
|
||||||
|
|
||||||
|
# Get memory information
|
||||||
|
mem_info=$(free -m | grep "Mem:")
|
||||||
|
mem_total=$(echo "$mem_info" | awk '{print $2}')
|
||||||
|
mem_used=$(echo "$mem_info" | awk '{print $3}')
|
||||||
|
mem_usage=$(awk "BEGIN {printf \"%.1f\", ($mem_used * 100) / $mem_total}")
|
||||||
|
|
||||||
|
# Output results
|
||||||
|
echo "CPU Usage: $cpu_usage"
|
||||||
|
echo "Memory Usage: $mem_usage"
|
||||||
|
echo "Memory Total: $((mem_total * 1024 * 1024))"
|
||||||
|
echo "Memory Used: $((mem_used * 1024 * 1024))"
|
||||||
@ -278,6 +278,76 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">系统状态</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="card-text table-responsive-sm">
|
||||||
|
<table class="table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">CPU使用率</th>
|
||||||
|
<td class="gap-4 align-items-center"
|
||||||
|
x-data="{ getProgressBarClass: function() {
|
||||||
|
var percentage = parseInt(this.cpuUsage);
|
||||||
|
if (percentage >= 80) {
|
||||||
|
return 'progress-bar bg-danger is-medium';
|
||||||
|
} else if (percentage >= 60) {
|
||||||
|
return 'progress-bar bg-warning is-warning is-medium';
|
||||||
|
} else {
|
||||||
|
return 'progress-bar bg-success is-medium';
|
||||||
|
}
|
||||||
|
}}"
|
||||||
|
>
|
||||||
|
<div class="progress w-100" role="progressbar"
|
||||||
|
aria-label="CPU Usage"
|
||||||
|
:aria-valuenow="cpuUsage"
|
||||||
|
aria-valuemin="0"
|
||||||
|
aria-valuemax="100"
|
||||||
|
style="height: 18px"
|
||||||
|
>
|
||||||
|
<div :class="getProgressBarClass()"
|
||||||
|
:style="'width: ' + cpuUsage + '%'"
|
||||||
|
>
|
||||||
|
<span x-text="cpuUsage + '%'"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">内存使用率</th>
|
||||||
|
<td class="gap-4 align-items-center"
|
||||||
|
x-data="{ getProgressBarClass: function() {
|
||||||
|
var percentage = parseInt(this.memoryUsage);
|
||||||
|
if (percentage >= 80) {
|
||||||
|
return 'progress-bar bg-danger is-medium';
|
||||||
|
} else if (percentage >= 60) {
|
||||||
|
return 'progress-bar bg-warning is-warning is-medium';
|
||||||
|
} else {
|
||||||
|
return 'progress-bar bg-success is-medium';
|
||||||
|
}
|
||||||
|
}}"
|
||||||
|
>
|
||||||
|
<div class="progress w-100" role="progressbar"
|
||||||
|
aria-label="Memory Usage"
|
||||||
|
:aria-valuenow="memoryUsage"
|
||||||
|
aria-valuemin="0"
|
||||||
|
aria-valuemax="100"
|
||||||
|
style="height: 18px"
|
||||||
|
>
|
||||||
|
<div :class="getProgressBarClass()"
|
||||||
|
:style="'width: ' + memoryUsage + '%'"
|
||||||
|
>
|
||||||
|
<span x-text="memoryUsage + '% (' + formatBytes(memoryUsed) + ' / ' + formatBytes(memoryTotal) + ')'"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">信号</div>
|
<div class="card-header">信号</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@ -649,6 +719,12 @@
|
|||||||
nonNrUpload: "0",
|
nonNrUpload: "0",
|
||||||
downloadStat: "0",
|
downloadStat: "0",
|
||||||
uploadStat: "0",
|
uploadStat: "0",
|
||||||
|
cpuUsage: "0",
|
||||||
|
memoryUsage: "0",
|
||||||
|
cacheUsage: "0",
|
||||||
|
memoryTotal: "0",
|
||||||
|
memoryUsed: "0",
|
||||||
|
cacheUsed: "0",
|
||||||
|
|
||||||
fetchAllInfo() {
|
fetchAllInfo() {
|
||||||
this.atcmd =
|
this.atcmd =
|
||||||
@ -1930,13 +2006,11 @@
|
|||||||
// Set the refresh rate for interval
|
// Set the refresh rate for interval
|
||||||
this.intervalId = setInterval(() => {
|
this.intervalId = setInterval(() => {
|
||||||
this.fetchUpTime();
|
this.fetchUpTime();
|
||||||
|
|
||||||
this.fetchAllInfo();
|
this.fetchAllInfo();
|
||||||
|
this.fetchSystemStats();
|
||||||
this.requestPing()
|
this.requestPing()
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const response = data.trim();
|
const response = data.trim();
|
||||||
// Trim any leading/trailing spaces
|
|
||||||
if (response === "OK") {
|
if (response === "OK") {
|
||||||
this.internetConnectionStatus = "已连接";
|
this.internetConnectionStatus = "已连接";
|
||||||
} else {
|
} else {
|
||||||
@ -1947,11 +2021,33 @@
|
|||||||
console.error("Error:", error);
|
console.error("Error:", error);
|
||||||
this.internetConnectionStatus = "已断开";
|
this.internetConnectionStatus = "已断开";
|
||||||
});
|
});
|
||||||
|
|
||||||
this.lastUpdate = new Date().toLocaleString();
|
this.lastUpdate = new Date().toLocaleString();
|
||||||
console.log("Refreshed");
|
console.log("Refreshed");
|
||||||
}, this.refreshRate * 1000);
|
}, this.refreshRate * 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fetchSystemStats() {
|
||||||
|
fetch("/cgi-bin/get_system_stats")
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(data => {
|
||||||
|
const lines = data.split("\n");
|
||||||
|
// Skip blank lines and Content-Type lines.
|
||||||
|
const validLines = lines.filter(line => line.trim() !== '' && line.includes(": ")).map(line => line.trim());
|
||||||
|
|
||||||
|
this.cpuUsage = parseFloat(validLines[0].split(": ")[1]).toFixed(1);
|
||||||
|
this.memoryUsage = parseFloat(validLines[1].split(": ")[1]).toFixed(1);
|
||||||
|
this.memoryTotal = parseInt(validLines[2].split(": ")[1]);
|
||||||
|
this.memoryUsed = parseInt(validLines[3].split(": ")[1]);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
formatBytes(bytes) {
|
||||||
|
if (bytes === 0) return '0 B';
|
||||||
|
const k = 1024;
|
||||||
|
const sizes = ['B', 'KB', 'MB', 'GB'];
|
||||||
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -90,6 +90,28 @@ remount_rw
|
|||||||
uninstall_simpleadmin() {
|
uninstall_simpleadmin() {
|
||||||
echo "Uninstalling Simpleadmin..."
|
echo "Uninstalling Simpleadmin..."
|
||||||
|
|
||||||
|
# Clean up Tailscale if present
|
||||||
|
if [ -d "/usrdata/tailscale" ]; then
|
||||||
|
echo "Cleaning up Tailscale..."
|
||||||
|
# Stop and logout from Tailscale
|
||||||
|
if [ -f "/usrdata/tailscale/tailscale" ]; then
|
||||||
|
/usrdata/tailscale/tailscale logout
|
||||||
|
/usrdata/tailscale/tailscale down
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl stop tailscale 2>/dev/null
|
||||||
|
systemctl stop tailscale-webui 2>/dev/null
|
||||||
|
rm -f /lib/systemd/system/tailscale.service
|
||||||
|
|
||||||
|
# Remove Tailscale files and directories
|
||||||
|
rm -rf /usrdata/tailscale
|
||||||
|
rm -f /bin/tailscale
|
||||||
|
rm -f /bin/tailscaled
|
||||||
|
|
||||||
|
# Reload systemd
|
||||||
|
systemctl daemon-reload
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if Lighttpd service is installed and remove it if present
|
# Check if Lighttpd service is installed and remove it if present
|
||||||
if [ -f "/lib/systemd/system/lighttpd.service" ]; then
|
if [ -f "/lib/systemd/system/lighttpd.service" ]; then
|
||||||
echo "Lighttpd detected, uninstalling Lighttpd webserver and its modules..."
|
echo "Lighttpd detected, uninstalling Lighttpd webserver and its modules..."
|
||||||
@ -209,6 +231,7 @@ echo -e "\e[1;31m2) Installing simpleadmin from the $GITTREE branch\e[0m"
|
|||||||
wget $GITROOT/simpleadmin/www/cgi-bin/user_atcommand
|
wget $GITROOT/simpleadmin/www/cgi-bin/user_atcommand
|
||||||
wget $GITROOT/simpleadmin/www/cgi-bin/get_ping
|
wget $GITROOT/simpleadmin/www/cgi-bin/get_ping
|
||||||
wget $GITROOT/simpleadmin/www/cgi-bin/get_sms
|
wget $GITROOT/simpleadmin/www/cgi-bin/get_sms
|
||||||
|
wget $GITROOT/simpleadmin/www/cgi-bin/get_system_stats
|
||||||
wget $GITROOT/simpleadmin/www/cgi-bin/get_ttl_status
|
wget $GITROOT/simpleadmin/www/cgi-bin/get_ttl_status
|
||||||
wget $GITROOT/simpleadmin/www/cgi-bin/set_ttl
|
wget $GITROOT/simpleadmin/www/cgi-bin/set_ttl
|
||||||
wget $GITROOT/simpleadmin/www/cgi-bin/send_sms
|
wget $GITROOT/simpleadmin/www/cgi-bin/send_sms
|
||||||
|
|||||||
@ -101,12 +101,12 @@ install_update_tailscale() {
|
|||||||
mkdir -p "$TAILSCALE_DIR" "$TAILSCALE_SYSD_DIR"
|
mkdir -p "$TAILSCALE_DIR" "$TAILSCALE_SYSD_DIR"
|
||||||
echo "Downloading binary files..."
|
echo "Downloading binary files..."
|
||||||
cd /usrdata
|
cd /usrdata
|
||||||
curl -O https://pkgs.tailscale.com/stable/tailscale_1.76.1_arm.tgz
|
curl -O https://pkgs.tailscale.com/stable/tailscale_1.78.1_arm.tgz
|
||||||
tar -xzf tailscale_1.76.1_arm.tgz
|
tar -xzf tailscale_1.78.1_arm.tgz
|
||||||
rm tailscale_1.76.1_arm.tgz
|
rm tailscale_1.78.1_arm.tgz
|
||||||
cd /usrdata/tailscale_1.76.1_arm
|
cd /usrdata/tailscale_1.78.1_arm
|
||||||
mv tailscale tailscaled "$TAILSCALE_DIR/"
|
mv tailscale tailscaled "$TAILSCALE_DIR/"
|
||||||
rm -rf /usrdata/tailscale_1.76.1_arm
|
rm -rf /usrdata/tailscale_1.78.1_arm
|
||||||
echo "Downloading systemd files..."
|
echo "Downloading systemd files..."
|
||||||
cd "$TAILSCALE_SYSD_DIR"
|
cd "$TAILSCALE_SYSD_DIR"
|
||||||
wget $GITROOT/tailscale/systemd/tailscaled.service
|
wget $GITROOT/tailscale/systemd/tailscaled.service
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user