Created
March 20, 2015 06:04
-
-
Save gigablah/da35ca7100e89e48107b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #+----------------------------------------------------------------------------------------+ | |
| #| This file is used to clean up traces from DigitalOcean *images* before being published.| | |
| #+----------------------------------------------------------------------------------------+ | |
| unset HISTFILE | |
| files=(/root/.mysql_history /var/log/lastlog /root/.bash_history /var/log/wtmp /var/log/auth.log /var/log/messages /root/.viminfo) | |
| for file in ${files[*]} | |
| do | |
| if [[ -f "$file" ]] | |
| then | |
| printf "\t%s\n" $file | |
| cat /dev/null > $file | |
| fi | |
| done | |
| rm -r /root/.cache | |
| rm -f /var/log/messages.* | |
| rm -f /var/log/*.gz | |
| if [ -f /etc/debian_version ] | |
| then | |
| DEBIAN_FRONTEND=noninteractive | |
| apt-get autoremove -y | |
| apt-get clean -y | |
| fi | |
| printf "\tPowering off.\n" | |
| history -w | |
| history -r | |
| history -c | |
| history -w && poweroff || poweroff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment