initial copy from local repo

This commit is contained in:
Josh North 2015-10-22 08:38:55 -04:00
parent 7a6637d869
commit df41f398bd

28
cleanup.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# /usr/local/bin/cleanup.sh
# ops.point808.com
# Quick and dirty script to clear disk space (log files, apt cache, etc etc) - useful if creating a machine template.
# --------------------------------------------------
# Nothing to change below here
# Delete old config files
apt-get purge $(dpkg -l|grep "^rc"|awk '{print $2}')
# Clean cache
apt-get autoremove -y && apt-get clean
# Clean apt lists - this will force re-download on next apt-get update and may not be desired
rm -rf /var/lib/apt/lists
# Delete some documentation
find /usr/share/doc -depth -type f ! -name copyright|xargs rm -rf
find /usr/share/doc -empty|xargs rmdir || true
rm -rf /usr/share/man/* /usr/share/groff/* /usr/share/info/*
rm -rf /usr/share/lintian/* /usr/share/linda/* /var/cache/man/*
find /usr/share/doc | egrep "\.gz" | xargs rm -rf
find /usr/share/doc | egrep "\.pdf$" | xargs rm -rf
find /usr/share/doc | egrep "\.tex$" | xargs rm -rf
find /usr/share/doc | egrep "\copyright" | xargs rm -rf
# Delete excess locales - modify if you want something else kept around!
find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en' |xargs rm -rf
# Delete old log files
logrotate -f /etc/logrotate.conf
find /var/log -type f -regex '.*/[^/]*.gz$' -delete && find /var/log -type f -regex '.*/[^/]*.[0-9]$' -delete
exit 0
# EOF