Last active
March 19, 2020 07:57
-
-
Save ylxdzsw/de3f0e7323e7898e6c433c419c51dbc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/pkexec /usr/bin/zsh | |
set -x | |
# clean up before backing up | |
pacman -Sc | |
journalctl --vacuum-time=7d | |
rm /var/lib/systemd/coredump/* | |
# backup based on last previous one to save disk space | |
TARGET=/run/media/ylxdzsw/DATA | |
NOW=$(date +%y-%m-%d) | |
LAST=$(tail -n 1 <(sort <(ls $TARGET))) | |
EX=("/dev/*" "/proc/*" "/sys/*" "/tmp/*" "/run/*" "/mnt/*" /home/ylxdzsw/.cache) | |
rsync -aAX --info=progress2 --exclude=$^EX --link-dest="$TARGET/$LAST" / "$TARGET/$NOW" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment