• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • The ImunifyAV extension is now deprecated and no longer available for installation.
    Existing ImunifyAV installations will continue operating for three months, and after that will automatically be replaced with the new Imunify extension. We recommend that you manually replace any existing ImunifyAV installations with Imunify at your earliest convenience.
Resource icon

Instruction How to find the busiest website by reading access log file

Here is a update to the code.

what i did was added easyer see how much traffic a website uses and put them last so its easy at a glance

#!/bin/bash

# Clear any existing queue file
> rxqueue.txt

# Find all access_log files under /var/www/vhosts and add them to the queue file
find /var/www/vhosts/system -name access_*_log > rxqueue.txt

# Temporary file to store sizes and paths
> size_output.txt

# Process each entry in the queue file
while IFS= read -r r; do
# Get the size of each file using the 'stat' command
size=$(stat -c '%s' "$r")

# Convert size to appropriate unit
if [ "$size" -ge 1073741824 ]; then
# Size is 1 GB or more
size_human=$(echo "scale=2; $size/1073741824" | bc)G
elif [ "$size" -ge 1048576 ]; then
# Size is 1 MB or more
size_human=$(echo "scale=2; $size/1048576" | bc)M
elif [ "$size" -ge 1024 ]; then
# Size is 1 KB or more
size_human=$(echo "scale=2; $size/1024" | bc)K
else
# Size is in bytes
size_human="${size}B"
fi

# Output size and file path to temporary file
echo "$size $size_human $r" >> size_output.txt
done < rxqueue.txt

# Sort by size (numeric, ascending) and print with human-readable units and paths
sort -n size_output.txt | awk '{print $2, $3}'

# Clean up temporary files
rm rxqueue.txt size_output.txt

# End of the script
Back
Top