#!/bin/bash # Benchmark Script - JowHost Edition # Usage: curl -Lso- bench.jowhost.com | bash clear # Color codes RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' CYAN='\033[0;36m' BOLD='\033[1m' NC='\033[0m' # No Color # Banner echo -e "${CYAN}${BOLD}" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ ║" echo "║ JowHost VPS Benchmark Script ║" echo "║ https://jowhost.com ║" echo "║ ║" echo "╚══════════════════════════════════════════════════════════════╝" echo -e "${NC}" # Function to print section header print_header() { echo "" echo -e "${CYAN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo -e "${GREEN}${BOLD} $1${NC}" echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" } # System Information print_header "📋 System Information" echo -e "${YELLOW}Hostname: ${NC}$(hostname)" echo -e "${YELLOW}OS: ${NC}$(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)" echo -e "${YELLOW}Kernel: ${NC}$(uname -r)" echo -e "${YELLOW}Uptime: ${NC}$(uptime -p)" echo -e "${YELLOW}Date: ${NC}$(date)" # CPU Information print_header "🖥️ CPU Information" CPU_MODEL=$(grep "model name" /proc/cpuinfo | head -n1 | cut -d: -f2 | sed 's/^[ \t]*//') CPU_CORES=$(grep -c ^processor /proc/cpuinfo) CPU_FREQ=$(grep "cpu MHz" /proc/cpuinfo | head -n1 | cut -d: -f2 | sed 's/^[ \t]*//') echo -e "${YELLOW}Model: ${NC}$CPU_MODEL" echo -e "${YELLOW}Cores: ${NC}$CPU_CORES" echo -e "${YELLOW}Frequency: ${NC}${CPU_FREQ} MHz" # Memory Information print_header "💾 Memory Information" TOTAL_RAM=$(free -h | grep Mem | awk '{print $2}') USED_RAM=$(free -h | grep Mem | awk '{print $3}') FREE_RAM=$(free -h | grep Mem | awk '{print $4}') SWAP_TOTAL=$(free -h | grep Swap | awk '{print $2}') SWAP_USED=$(free -h | grep Swap | awk '{print $3}') echo -e "${YELLOW}Total: ${NC}$TOTAL_RAM" echo -e "${YELLOW}Used: ${NC}$USED_RAM" echo -e "${YELLOW}Free: ${NC}$FREE_RAM" echo -e "${YELLOW}Swap Total: ${NC}$SWAP_TOTAL" echo -e "${YELLOW}Swap Used: ${NC}$SWAP_USED" # Disk Information print_header "💿 Disk Information" echo -e "${YELLOW}Filesystem Size Used Avail Use%${NC}" df -h | grep -E '^/dev/' | awk '{printf "%-20s %-9s %-9s %-9s %-9s\n", $1, $2, $3, $4, $5}' # Network Information print_header "🌐 Network Information" PUBLIC_IP=$(timeout 5 curl -s ifconfig.me 2>/dev/null || echo "N/A") HOSTNAME_IP=$(hostname -I | awk '{print $1}') echo -e "${YELLOW}Public IP: ${NC}$PUBLIC_IP" echo -e "${YELLOW}Local IP: ${NC}$HOSTNAME_IP" # CPU Benchmark print_header "⚡ CPU Benchmark" echo -e "${CYAN}Running CPU benchmark (calculating pi to 5000 digits)...${NC}" CPU_TIME=$(timeout 30 sh -c 'echo "scale=5000; 4*a(1)" | bc -l -q 2>/dev/null' 2>&1 | grep real | awk '{print $2}') if [ -z "$CPU_TIME" ]; then CPU_TIME=$(TIMEFORMAT='%3R'; time (echo "scale=5000; 4*a(1)" | bc -l -q 2>/dev/null) 2>&1 | tail -n1) fi echo -e "${YELLOW}Time taken: ${NC}${CPU_TIME}s ${GREEN}(lower is better)${NC}" # Disk I/O Benchmark (Write) print_header "📝 Disk I/O Benchmark - Write Speed" echo -e "${CYAN}Testing disk write speed (writing 512MB file)...${NC}" WRITE_RESULT=$(dd if=/dev/zero of=/tmp/test_write bs=64k count=8192 conv=fdatasync 2>&1) WRITE_SPEED=$(echo "$WRITE_RESULT" | tail -1 | awk '{print $(NF-1), $NF}') rm -f /tmp/test_write echo -e "${YELLOW}Write Speed: ${NC}${WRITE_SPEED}" # Disk I/O Benchmark (Read) print_header "📖 Disk I/O Benchmark - Read Speed" echo -e "${CYAN}Testing disk read speed (reading 512MB file)...${NC}" # Create test file dd if=/dev/zero of=/tmp/test_read bs=64k count=8192 conv=fdatasync 2>/dev/null # Clear cache sync echo 3 > /proc/sys/vm/drop_caches 2>/dev/null # Read test READ_RESULT=$(dd if=/tmp/test_read of=/dev/null bs=64k 2>&1) READ_SPEED=$(echo "$READ_RESULT" | tail -1 | awk '{print $(NF-1), $NF}') rm -f /tmp/test_read echo -e "${YELLOW}Read Speed: ${NC}${READ_SPEED}" # Network Speed Test (Download) print_header "🚀 Network Speed Test" echo -e "${CYAN}Testing download speed (10MB file)...${NC}" # Download speed test with timeout TEMP_FILE="/tmp/speedtest_$$" START_TIME=$(date +%s) timeout 15 curl -o "$TEMP_FILE" -s --max-time 15 http://speedtest.tele2.net/10MB.zip 2>/dev/null END_TIME=$(date +%s) ELAPSED=$((END_TIME - START_TIME)) if [ -f "$TEMP_FILE" ]; then FILE_SIZE=$(stat -f%z "$TEMP_FILE" 2>/dev/null || stat -c%s "$TEMP_FILE" 2>/dev/null) if [ "$ELAPSED" -gt 0 ] && [ "$FILE_SIZE" -gt 0 ]; then DOWNLOAD_MBPS=$(echo "scale=2; ($FILE_SIZE / 1024 / 1024) / $ELAPSED" | bc) echo -e "${YELLOW}Download Speed: ${NC}${DOWNLOAD_MBPS} MB/s" else echo -e "${YELLOW}Download Speed: ${NC}N/A" fi rm -f "$TEMP_FILE" else echo -e "${YELLOW}Download Speed: ${NC}N/A ${RED}(timeout or failed)${NC}" fi # Geolocation print_header "🌍 Geolocation" LOCATION=$(timeout 5 curl -s ipinfo.io/$PUBLIC_IP 2>/dev/null | grep -E '"city"|"region"|"country"' | awk -F'"' '{print $4}' | paste -sd ', ' -) if [ -n "$LOCATION" ]; then echo -e "${YELLOW}Location: ${NC}$LOCATION" else echo -e "${YELLOW}Location: ${NC}N/A" fi # Load Average print_header "📊 System Load" LOAD_AVG=$(uptime | awk -F'load average:' '{print $2}') echo -e "${YELLOW}Load Average: ${NC}$LOAD_AVG" # Summary print_header "✅ Benchmark Completed" echo "" echo -e "${GREEN}${BOLD} ✓ Benchmark completed successfully!${NC}" echo -e "${CYAN} → Thank you for using JowHost Benchmark Script${NC}" echo -e "${CYAN} → Visit: ${BOLD}https://jowhost.com${NC}${CYAN} for more services${NC}" echo "" echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo ""