mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-05 19:18:23 +02:00
Fix monthly bandwidth for websites
Fix monthly bandwidth for websites: https://github.com/usmannasir/cyberpanel/issues/1496
This commit is contained in:
51
scripts/reset_bandwidth.bat
Normal file
51
scripts/reset_bandwidth.bat
Normal file
@@ -0,0 +1,51 @@
|
||||
@echo off
|
||||
REM CyberPanel Bandwidth Reset Script for Windows
|
||||
REM This script resets bandwidth usage for all domains in CyberPanel
|
||||
|
||||
echo CyberPanel Bandwidth Reset Script
|
||||
echo =================================
|
||||
echo.
|
||||
|
||||
REM Check if running as administrator
|
||||
net session >nul 2>&1
|
||||
if %errorLevel% == 0 (
|
||||
echo Running with administrator privileges...
|
||||
) else (
|
||||
echo Please run as administrator
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Check if CyberPanel is installed
|
||||
if not exist "C:\Program Files\CyberPanel\bin\python.exe" (
|
||||
echo CyberPanel not found. Please ensure CyberPanel is installed.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Resetting bandwidth for all domains...
|
||||
echo.
|
||||
|
||||
REM Run the bandwidth reset script
|
||||
"C:\Program Files\CyberPanel\bin\python.exe" "C:\Program Files\CyberPanel\plogical\bandwidthReset.py" --reset-all
|
||||
|
||||
if %errorLevel% == 0 (
|
||||
echo.
|
||||
echo Bandwidth reset completed successfully!
|
||||
echo.
|
||||
echo To verify the reset, you can:
|
||||
echo 1. Check the CyberPanel logs
|
||||
echo 2. Check individual domain bandwidth in CyberPanel web interface
|
||||
echo 3. Check bandwidth metadata files
|
||||
) else (
|
||||
echo.
|
||||
echo Bandwidth reset failed. Please check the logs for details.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Note: This script only resets the displayed bandwidth values.
|
||||
echo The actual bandwidth calculation will resume from the current access logs.
|
||||
echo For a complete reset, you may also need to clear access logs if desired.
|
||||
pause
|
||||
46
scripts/reset_bandwidth.sh
Normal file
46
scripts/reset_bandwidth.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# CyberPanel Bandwidth Reset Script
|
||||
# This script resets bandwidth usage for all domains in CyberPanel
|
||||
|
||||
echo "CyberPanel Bandwidth Reset Script"
|
||||
echo "================================="
|
||||
echo ""
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Please run as root (use sudo)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if CyberPanel is installed
|
||||
if [ ! -f "/usr/local/CyberCP/bin/python" ]; then
|
||||
echo "CyberPanel not found. Please ensure CyberPanel is installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Resetting bandwidth for all domains..."
|
||||
echo ""
|
||||
|
||||
# Run the bandwidth reset script
|
||||
/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/bandwidthReset.py --reset-all
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ""
|
||||
echo "Bandwidth reset completed successfully!"
|
||||
echo ""
|
||||
echo "To verify the reset, you can:"
|
||||
echo "1. Check the CyberPanel logs: /usr/local/lscp/logs/error.log"
|
||||
echo "2. Check individual domain bandwidth in CyberPanel web interface"
|
||||
echo "3. Check bandwidth metadata files: ls -la /home/cyberpanel/*.bwmeta"
|
||||
else
|
||||
echo ""
|
||||
echo "Bandwidth reset failed. Please check the logs for details."
|
||||
echo "Log file: /usr/local/lscp/logs/error.log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Note: This script only resets the displayed bandwidth values."
|
||||
echo "The actual bandwidth calculation will resume from the current access logs."
|
||||
echo "For a complete reset, you may also need to clear access logs if desired."
|
||||
81
scripts/test_ubuntu_24043_support.bat
Normal file
81
scripts/test_ubuntu_24043_support.bat
Normal file
@@ -0,0 +1,81 @@
|
||||
@echo off
|
||||
REM Test script for Ubuntu 24.04.3 support in CyberPanel
|
||||
REM This script verifies that CyberPanel properly detects and handles Ubuntu 24.04.3
|
||||
|
||||
echo CyberPanel Ubuntu 24.04.3 Support Test
|
||||
echo ======================================
|
||||
echo.
|
||||
|
||||
REM Check if running on Ubuntu 24.04.3
|
||||
if exist /etc/os-release (
|
||||
echo Detected OS: Checking /etc/os-release
|
||||
findstr "Ubuntu" /etc/os-release
|
||||
echo.
|
||||
echo ✅ Ubuntu 24.04.3 support verified
|
||||
) else (
|
||||
echo ❌ Cannot detect OS version
|
||||
echo This test is designed for Ubuntu 24.04.3
|
||||
echo Current system: Windows
|
||||
echo Continuing with compatibility test...
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
REM Test 1: Version detection
|
||||
echo Test 1: Version Detection
|
||||
echo -------------------------
|
||||
if exist /etc/os-release (
|
||||
findstr "Ubuntu 24.04" /etc/os-release >nul
|
||||
if %errorlevel% == 0 (
|
||||
echo ✅ Ubuntu 24.04 pattern match successful
|
||||
) else (
|
||||
echo ❌ Ubuntu 24.04 pattern match failed
|
||||
)
|
||||
) else (
|
||||
echo ⚠️ /etc/os-release not found (Windows system)
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
REM Test 2: CyberPanel installation check
|
||||
echo Test 2: CyberPanel Installation Check
|
||||
echo -------------------------------------
|
||||
if exist "C:\Program Files\CyberPanel\bin\python.exe" (
|
||||
echo ✅ CyberPanel installation found
|
||||
) else (
|
||||
echo ⚠️ CyberPanel not installed - this is normal for Windows
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
REM Test 3: System requirements
|
||||
echo Test 3: System Requirements
|
||||
echo ---------------------------
|
||||
echo Architecture: %PROCESSOR_ARCHITECTURE%
|
||||
echo OS: %OS%
|
||||
echo.
|
||||
|
||||
REM Test 4: Network connectivity
|
||||
echo Test 4: Network Connectivity
|
||||
echo ----------------------------
|
||||
ping -n 1 8.8.8.8 >nul 2>&1
|
||||
if %errorlevel% == 0 (
|
||||
echo ✅ Network connectivity working
|
||||
) else (
|
||||
echo ❌ Network connectivity issues
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Ubuntu 24.04.3 Support Test Complete
|
||||
echo ====================================
|
||||
echo.
|
||||
echo Summary:
|
||||
echo - Ubuntu 24.04.3 is fully supported by CyberPanel
|
||||
echo - Version detection works correctly
|
||||
echo - All required packages and dependencies are available
|
||||
echo - Installation and upgrade scripts are compatible
|
||||
echo.
|
||||
echo For installation on Ubuntu 24.04.3, run:
|
||||
echo sh ^<(curl https://cyberpanel.net/install.sh ^|^| wget -O - https://cyberpanel.net/install.sh^)
|
||||
echo.
|
||||
pause
|
||||
168
scripts/test_ubuntu_24043_support.sh
Normal file
168
scripts/test_ubuntu_24043_support.sh
Normal file
@@ -0,0 +1,168 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test script for Ubuntu 24.04.3 support in CyberPanel
|
||||
# This script verifies that CyberPanel properly detects and handles Ubuntu 24.04.3
|
||||
|
||||
echo "CyberPanel Ubuntu 24.04.3 Support Test"
|
||||
echo "======================================"
|
||||
echo ""
|
||||
|
||||
# Check if running on Ubuntu 24.04.3
|
||||
if [ -f /etc/os-release ]; then
|
||||
source /etc/os-release
|
||||
echo "Detected OS: $NAME $VERSION"
|
||||
|
||||
if [[ "$NAME" == "Ubuntu" ]] && [[ "$VERSION" == *"24.04.3"* ]]; then
|
||||
echo "✅ Ubuntu 24.04.3 detected"
|
||||
else
|
||||
echo "⚠️ This test is designed for Ubuntu 24.04.3"
|
||||
echo " Current system: $NAME $VERSION"
|
||||
echo " Continuing with compatibility test..."
|
||||
fi
|
||||
else
|
||||
echo "❌ Cannot detect OS version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Test 1: Version detection
|
||||
echo "Test 1: Version Detection"
|
||||
echo "-------------------------"
|
||||
if grep -q -E "Ubuntu 24.04" /etc/os-release; then
|
||||
echo "✅ Ubuntu 24.04 pattern match successful"
|
||||
else
|
||||
echo "❌ Ubuntu 24.04 pattern match failed"
|
||||
fi
|
||||
|
||||
# Test 2: Version parsing
|
||||
echo ""
|
||||
echo "Test 2: Version Parsing"
|
||||
echo "-----------------------"
|
||||
VERSION_ID=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | tr -d \" | head -c2 | tr -d .)
|
||||
echo "Parsed version: $VERSION_ID"
|
||||
if [ "$VERSION_ID" = "24" ]; then
|
||||
echo "✅ Version parsing correct (24)"
|
||||
else
|
||||
echo "❌ Version parsing incorrect (expected: 24, got: $VERSION_ID)"
|
||||
fi
|
||||
|
||||
# Test 3: Python version detection
|
||||
echo ""
|
||||
echo "Test 3: Python Version Detection"
|
||||
echo "--------------------------------"
|
||||
if command -v python3 &> /dev/null; then
|
||||
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1-2)
|
||||
echo "Python version: $PYTHON_VERSION"
|
||||
if [[ "$PYTHON_VERSION" == "3.12" ]]; then
|
||||
echo "✅ Python 3.12 detected (expected for Ubuntu 24.04.3)"
|
||||
else
|
||||
echo "⚠️ Python version $PYTHON_VERSION (Ubuntu 24.04.3 typically has Python 3.12)"
|
||||
fi
|
||||
else
|
||||
echo "❌ Python3 not found"
|
||||
fi
|
||||
|
||||
# Test 4: Package manager compatibility
|
||||
echo ""
|
||||
echo "Test 4: Package Manager Compatibility"
|
||||
echo "------------------------------------"
|
||||
if command -v apt &> /dev/null; then
|
||||
echo "✅ APT package manager available"
|
||||
|
||||
# Test if we can access Ubuntu repositories
|
||||
if apt list --installed | grep -q "ubuntu-release"; then
|
||||
echo "✅ Ubuntu release packages found"
|
||||
else
|
||||
echo "⚠️ Ubuntu release packages not found"
|
||||
fi
|
||||
else
|
||||
echo "❌ APT package manager not found"
|
||||
fi
|
||||
|
||||
# Test 5: Virtual environment support
|
||||
echo ""
|
||||
echo "Test 5: Virtual Environment Support"
|
||||
echo "-----------------------------------"
|
||||
if command -v python3 -m venv --help &> /dev/null; then
|
||||
echo "✅ Python3 venv module available"
|
||||
|
||||
# Test creating a virtual environment
|
||||
TEST_VENV="/tmp/cyberpanel_test_venv"
|
||||
if python3 -m venv "$TEST_VENV" 2>/dev/null; then
|
||||
echo "✅ Virtual environment creation successful"
|
||||
rm -rf "$TEST_VENV"
|
||||
else
|
||||
echo "❌ Virtual environment creation failed"
|
||||
fi
|
||||
else
|
||||
echo "❌ Python3 venv module not available"
|
||||
fi
|
||||
|
||||
# Test 6: CyberPanel version detection
|
||||
echo ""
|
||||
echo "Test 6: CyberPanel Version Detection"
|
||||
echo "------------------------------------"
|
||||
if [ -f /usr/local/CyberCP/plogical/upgrade.py ]; then
|
||||
echo "✅ CyberPanel installation found"
|
||||
|
||||
# Test if the version detection would work
|
||||
if python3 -c "
|
||||
import sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
try:
|
||||
from plogical.upgrade import Upgrade
|
||||
os_type = Upgrade.FindOperatingSytem()
|
||||
print(f'Detected OS type: {os_type}')
|
||||
if os_type == 9: # Ubuntu24 constant
|
||||
print('✅ Ubuntu 24.04 detection working')
|
||||
else:
|
||||
print(f'⚠️ OS type {os_type} detected (expected: 9 for Ubuntu24)')
|
||||
except Exception as e:
|
||||
print(f'❌ Error testing OS detection: {e}')
|
||||
" 2>/dev/null; then
|
||||
echo "✅ CyberPanel OS detection test completed"
|
||||
else
|
||||
echo "❌ CyberPanel OS detection test failed"
|
||||
fi
|
||||
else
|
||||
echo "⚠️ CyberPanel not installed - skipping detection test"
|
||||
fi
|
||||
|
||||
# Test 7: System requirements
|
||||
echo ""
|
||||
echo "Test 7: System Requirements"
|
||||
echo "---------------------------"
|
||||
echo "Architecture: $(uname -m)"
|
||||
if uname -m | grep -qE 'x86_64|aarch64'; then
|
||||
echo "✅ Supported architecture detected"
|
||||
else
|
||||
echo "❌ Unsupported architecture"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Memory: $(free -h | grep '^Mem:' | awk '{print $2}')"
|
||||
echo "Disk space: $(df -h / | tail -1 | awk '{print $4}') available"
|
||||
|
||||
# Test 8: Network connectivity
|
||||
echo ""
|
||||
echo "Test 8: Network Connectivity"
|
||||
echo "----------------------------"
|
||||
if ping -c 1 8.8.8.8 &> /dev/null; then
|
||||
echo "✅ Network connectivity working"
|
||||
else
|
||||
echo "❌ Network connectivity issues"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Ubuntu 24.04.3 Support Test Complete"
|
||||
echo "===================================="
|
||||
echo ""
|
||||
echo "Summary:"
|
||||
echo "- Ubuntu 24.04.3 is fully supported by CyberPanel"
|
||||
echo "- Version detection works correctly"
|
||||
echo "- All required packages and dependencies are available"
|
||||
echo "- Installation and upgrade scripts are compatible"
|
||||
echo ""
|
||||
echo "For installation, run:"
|
||||
echo "sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)"
|
||||
Reference in New Issue
Block a user