mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-21 12:59:41 +00:00
fix+refact(system-cleanup) (#856)
* fix(system-cleanup): some issues * new packager quotes
This commit is contained in:
parent
51631a16cb
commit
e3688e9b3d
23
core/tabs/system-setup/system-cleanup.sh
Normal file → Executable file
23
core/tabs/system-setup/system-cleanup.sh
Normal file → Executable file
|
@ -26,16 +26,21 @@ cleanup_system() {
|
|||
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
return 1
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
common_cleanup() {
|
||||
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete
|
||||
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete
|
||||
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
|
||||
if [ -d /var/tmp ]; then
|
||||
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete
|
||||
fi
|
||||
if [ -d /tmp ]; then
|
||||
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete
|
||||
fi
|
||||
if [ -d /var/log ]; then
|
||||
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
|
||||
fi
|
||||
"$ESCALATION_TOOL" journalctl --vacuum-time=3d
|
||||
}
|
||||
|
||||
|
@ -45,8 +50,12 @@ clean_data() {
|
|||
case $clean_response in
|
||||
y|Y)
|
||||
printf "%b\n" "${YELLOW}Cleaning up old cache files and emptying trash...${RC}"
|
||||
find "$HOME/.cache/" -type f -atime +5 -delete
|
||||
find "$HOME/.local/share/Trash" -mindepth 1 -delete
|
||||
if [ -d "$HOME/.cache" ]; then
|
||||
find "$HOME/.cache/" -type f -atime +5 -delete
|
||||
fi
|
||||
if [ -d "$HOME/.local/share/Trash" ]; then
|
||||
find "$HOME/.local/share/Trash" -mindepth 1 -delete
|
||||
fi
|
||||
printf "%b\n" "${GREEN}Cache and trash cleanup completed.${RC}"
|
||||
;;
|
||||
*)
|
||||
|
|
Loading…
Reference in New Issue
Block a user