1
0
mirror of https://github.com/tteck/Proxmox.git synced 2024-12-26 10:49:56 +02:00
Proxmox/misc/clean.sh

48 lines
1.2 KiB
Bash
Raw Normal View History

2023-01-28 23:17:46 +02:00
#!/usr/bin/env bash
2023-02-07 19:15:22 +02:00
2024-01-01 19:13:05 +02:00
# Copyright (c) 2021-2024 tteck
2023-02-07 19:15:22 +02:00
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
2023-01-29 22:20:01 +02:00
function header_info() {
2023-09-13 17:48:21 +02:00
clear
cat <<"EOF"
2023-01-28 23:17:46 +02:00
________ __ _ ________
/ ____/ /__ ____ _____ / / | |/ / ____/
2023-09-13 17:48:21 +02:00
/ / / / _ \/ __ `/ __ \ / / | / /
/ /___/ / __/ /_/ / / / / / /___/ / /___
\____/_/\___/\__,_/_/ /_/ /_____/_/|_\____/
2023-01-28 23:17:46 +02:00
EOF
}
BL=$(echo "\033[36m")
GN=$(echo "\033[1;92m")
CL=$(echo "\033[m")
name=$(hostname)
header_info
2023-01-29 18:01:07 +02:00
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
2023-01-28 23:17:46 +02:00
cache=$(find /var/cache/ -type f)
2023-01-29 22:20:01 +02:00
if [[ -z "$cache" ]]; then
echo -e "It appears there are no cached files on your system. \n"
sleep 2
else
2023-09-13 17:48:21 +02:00
find /var/cache -type f -delete
echo "Successfully Removed Cache"
sleep 2
2023-01-29 22:20:01 +02:00
fi
2023-01-28 23:17:46 +02:00
header_info
2023-01-29 18:01:07 +02:00
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
2023-01-28 23:17:46 +02:00
logs=$(find /var/log/ -type f)
2023-01-29 22:20:01 +02:00
if [[ -z "$logs" ]]; then
echo -e "It appears there are no logs on your system. \n"
sleep 2
else
2023-09-13 17:48:21 +02:00
find /var/log -type f -delete
echo "Successfully Removed Logs"
sleep 2
2023-01-29 22:20:01 +02:00
fi
header_info
echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n"
echo -e "${GN}Populating apt lists${CL} \n"