Skip to content

Instantly share code, notes, and snippets.

@lyndell

lyndell/du-logs.sh

Last active Oct 23, 2015
Embed
What would you like to do?
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