clean.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. function header_info() {
  7. clear
  8. cat <<"EOF"
  9. ________ __ _ ________
  10. / ____/ /__ ____ _____ / / | |/ / ____/
  11. / / / / _ \/ __ `/ __ \ / / | / /
  12. / /___/ / __/ /_/ / / / / / /___/ / /___
  13. \____/_/\___/\__,_/_/ /_/ /_____/_/|_\____/
  14. EOF
  15. }
  16. BL=$(echo "\033[36m")
  17. GN=$(echo "\033[1;92m")
  18. CL=$(echo "\033[m")
  19. name=$(hostname)
  20. header_info
  21. echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
  22. cache=$(find /var/cache/ -type f)
  23. if [[ -z "$cache" ]]; then
  24. echo -e "It appears there are no cached files on your system. \n"
  25. sleep 2
  26. else
  27. find /var/cache -type f -delete
  28. echo "Successfully Removed Cache"
  29. sleep 2
  30. fi
  31. header_info
  32. echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
  33. logs=$(find /var/log/ -type f)
  34. if [[ -z "$logs" ]]; then
  35. echo -e "It appears there are no logs on your system. \n"
  36. sleep 2
  37. else
  38. find /var/log -type f -delete
  39. echo "Successfully Removed Logs"
  40. sleep 2
  41. fi
  42. header_info
  43. echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
  44. echo -e "${GN}Populating apt lists${CL} \n"