Report Command Terminal
๐ง STEP 1: Navigate to your folder
Open your SSH terminal and run:
bash
Copy
Edit
cd ~/url-checker
๐ง STEP 2: Clean up previous files (optional)
To start fresh, delete the old report:
bash
Copy
Edit
rm -f report.txt
๐ง STEP 3: Create or update your script
Open or create the script file:
bash
Copy
Edit
nano cache-check.sh
Paste this inside:
bash
Copy
Edit
#!/bin/bash
rm -f report.txt # Clear old report
while read -r url; do
echo "Checking: $url"
# Get headers silently
headers=$(curl -s -I "$url")
# Extract HTTP status code
status_code=$(echo "$headers" | grep HTTP | awk '{print $2}' | head -n 1)
# Extract Cloudflare cache status
cf_status=$(echo "$headers" | grep -i "cf-cache-status" | awk '{print $2}')
# Extract LiteSpeed cache control
ls_status=$(echo "$headers" | grep -i "x-litespeed-cache-control" | cut -d' ' -f2-)
# Output to file
{
echo "URL: $url"
echo " HTTP Status: ${status_code:-Unknown}"
echo " Cloudflare: ${cf_status:-MISS/Not Cached}"
echo " LiteSpeed: ${ls_status:-MISS/Not Cached}"
echo "----------------------------------------"
} >> report.txt
# Echo to terminal
echo "HTTP Status: ${status_code:-Unknown}"
echo "Cloudflare: ${cf_status:-MISS/Not Cached}"
echo "LiteSpeed: ${ls_status:-MISS/Not Cached}"
echo "----------------------------------------"
sleep 1
done < urls.txt
Save and exit:
Press Ctrl + O, then Enter to save
Press Ctrl + X to exit
๐ง STEP 4: Make the script executable (only once)
bash
Copy
Edit
chmod +x cache-check.sh
✅ STEP 5: Run the checker
Now run it:
bash
Copy
Edit
./cache-check.sh
This will:
Read each URL from urls.txt
Check status, Cloudflare cache, and LiteSpeed cache
Output results to both terminal and report.txt
๐งพ STEP 6: View your report
When it’s done:
bash
Copy
Edit
cat report.txt
Comments
Post a Comment