Skip to content

Instantly share code, notes, and snippets.

@lyndell
Last active October 23, 2015 04:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lyndell/e1c86f24977363305444 to your computer and use it in GitHub Desktop.
Disk usage from logs.
#!/bin/bash
#
# Example output:
#
# ```bash
# root@server [~]# df -h /usr
# Filesystem Size Used Avail Use% Mounted on
# /dev/sda3 7.8G 7.4G 112K 100% /usr
# root@server [~]#
# root@server [~]# cd /usr/local/
# root@server [/usr/local]# du -sch cpanel/logs/ apache/{logs,domlogs}
# 153M cpanel/logs/
# 184M apache/logs
# 309M apache/domlogs
# 646M total
# root@server [/usr/local]#
# ```
#
set -x
if [ ! -e /usr/local/cpanel/cpanel ]
then
echo "Not cPanel;"
exit
fi
df -h /usr
cd /usr/local/
du -sch cpanel/{logs,src,rollbacks}/ apache/{logs,domlogs}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment