Skip to content

Instantly share code, notes, and snippets.

@DrizzlyOwl
Created July 27, 2021 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DrizzlyOwl/78186cda92fa849119cbd3f35f0df7fb to your computer and use it in GitHub Desktop.
Save DrizzlyOwl/78186cda92fa849119cbd3f35f0df7fb to your computer and use it in GitHub Desktop.
diskme.sh
#! /bin/bash
#
# Author: Ash Davies
# Description: Analyse disk space usage per directory within the apache document root.
# Useful for running on a cron job to monitor directory sizes.
host=$(hostname)
apachedir="/var/www/vhosts"
echo "Server name: $host"
lsb_release -d
echo ""
df -h $apachedir
echo
du -sh $apachedir
echo "";
for d in $apachedir/*/ ;
do (
du -hs "$d"
);
done | sort -hr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment