Skip to content

Commit aae8371

Browse files
committed
feat: add gio trash clean to the maintenance
1 parent d32d0a4 commit aae8371

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

.bin/maintenance.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ delete_path() {
2727
# ---------------------------------------
2828
# 1. Remove known unnecessary dirs/files
2929
# ---------------------------------------
30-
printf "${CYAN}[1/5] Removing unused files and directories...${RESET}\n"
30+
printf "${CYAN}[1/6] Removing unused files and directories...${RESET}\n"
3131

3232
delete_path "${HOME}/.android" # Android SDK leftovers
3333
delete_path "${HOME}/.cargo" # Rust cache
@@ -55,7 +55,7 @@ fi
5555
# ------------------------
5656
# 2. Clear cliphist cache
5757
# ------------------------
58-
printf "${CYAN}[2/5] Clearing cliphist cache...${RESET}\n"
58+
printf "${CYAN}[2/6] Clearing cliphist cache...${RESET}\n"
5959
if command -v cliphist &>/dev/null; then
6060
cliphist wipe && printf "${GREEN}cliphist cache wiped${RESET}\n"
6161
else
@@ -65,22 +65,28 @@ fi
6565
# -------------------------------
6666
# 3. Vacuum systemd journal logs
6767
# -------------------------------
68-
printf "${CYAN}[3/5] Vacuuming journal logs older than 7 days...${RESET}\n"
68+
printf "${CYAN}[3/6] Vacuuming journal logs older than 7 days...${RESET}\n"
6969
sudo journalctl --vacuum-time=7d &&
7070
printf "${GREEN}Journal logs vacuumed${RESET}\n"
7171

7272
# --------------------------
7373
# 4. Clean stale /tmp files
7474
# --------------------------
75-
printf "${CYAN}[4/5] Cleaning stale /tmp files (older than 3 days)...${RESET}\n"
75+
printf "${CYAN}[4/6] Cleaning stale /tmp files (older than 3 days)...${RESET}\n"
7676
sudo find /tmp -mindepth 1 -mtime +3 -print0 | while IFS= read -r -d '' file; do
7777
sudo rm -rf "$file" && printf "${GREEN}Deleted stale tmp:${RESET} %s\n" "$file"
7878
done
7979

80+
# ---------------
81+
# 5. Empty trash
82+
# ---------------
83+
printf "${CYAN}[5/6] Cleaning stale /tmp files (older than 3 days)...${RESET}\n"
84+
gio trash --empty
85+
8086
# ----------------------------------
81-
# 5. Run rmlint on selected folders
87+
# 6. Run rmlint on selected folders
8288
# ----------------------------------
83-
printf "${CYAN}[5/5] Running rmlint on select folders...${RESET}\n"
89+
printf "${CYAN}[6/6] Running rmlint on select folders...${RESET}\n"
8490
RMLINT_TARGETS=(
8591
"${HOME}/Documents"
8692
"${HOME}/Videos"

0 commit comments

Comments
 (0)