Tesy

RPI delLogs

Sep 30th, 2014
301
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. logs=(
  4. "/var/log/auth.log.*"
  5. "/var/log/daemon.log.*"
  6. "/var/log/debug.*"
  7. "/var/log/fail2ban.log.*"
  8. "/var/log/kern.log.*"
  9. "/var/log/messages.*"
  10. "/var/log/syslog.*"
  11. "/var/log/vsftpd.log.*"
  12. "/var/log/apache2/access.log.*"
  13. "/var/log/apache2/error.log.*"
  14. "/var/log/apache2/other_vhosts_access.log.*"
  15. "/var/log/apache2/rutorrent_error.log.*"
  16. "/var/log/apache2/rutorrent.log.*"
  17. "/var/log/samba/log.nmbd.*"
  18. "/var/log/samba/log.smbd.*"
  19. )
  20.  
  21. echo -e "\e[33mDeletings logs...\e[0m"
  22.  
  23. for i in ${logs[*]}
  24.  do
  25.   if [ -e "$i" ]
  26.    then
  27.     echo -e "$i \e[32mDone\e[0m"
  28.     sudo rm $i
  29.    fi
  30.  done
  31.  
  32. echo -e "\e[33mAll of old logs deleted\e[0m"
RAW Paste Data