diff --git a/bin/backup b/bin/backup index 94c5767..5c4b401 100755 --- a/bin/backup +++ b/bin/backup @@ -20,8 +20,8 @@ ########## _version() { cat < "${redirection}" done # Rotate journal -journalctl --flush --rotate --vacuum-time="${journal_retention}" +sudo journalctl --flush --rotate --vacuum-time="${journal_retention}" "${quiet[@]}" -# cache -find /var/cache -mindepth 1 -delete -find /var/lib/snapd/cache -mindepth 1 -delete +# System caches +[[ -d /var/cache ]] && sudo find /var/cache -mindepth 1 -delete +[[ -d /var/lib/snapd/cache ]] && sudo find /var/lib/snapd/cache -mindepth 1 -delete + +# User caches +for user in "${users[@]}"; do + if ! homedir=$(getent passwd "${user}" | cut -d: -f6); then + echo "User not exits: ${user}" 1>&2 + exit 1 + fi + + # Empty trash bin + sudo test -d "${homedir}/.local/share/Trash" && sudo find "${homedir}/.local/share/Trash" -mindepth 1 -delete + # General cache + sudo test -d "${homedir}/.cache" && sudo find "${homedir}/.cache" -mindepth 1 -delete + # Atom cache + sudo test -d "${homedir}/.atom/.apm/_cacache" && sudo find "${homedir}/.atom/.apm/_cacache" -mindepth 1 -delete + # Chrome cache + sudo test -d "${homedir}/.config/google-chrome" && sudo find "${homedir}/.config/google-chrome" -mindepth 1 -delete + # gdfuse (Google Drive FS) cache + sudo test -d "${homedir}/.gdfuse/${user}/cache" && sudo find "${homedir}/.gdfuse/${user}/cache" -mindepth 1 -delete + # Flush Spotify cache + sudo test -d "${homedir}/snap/spotify/common/.cache" && sudo find "${homedir}/snap/spotify/common/.cache" -mindepth 1 -delete +done exit 0 diff --git a/bin/pass-man b/bin/pass-man index 773a930..f019644 100755 --- a/bin/pass-man +++ b/bin/pass-man @@ -22,14 +22,14 @@ _usage() { cat <