Nice homework you got there. Imo you need to read the manpages for cron or systemd timers, to schedule your tasks. Any cloud based calendar app can help you for the notification. And I think any genai tool can get you a suitable chunk of code depending on your specifics about the scripting.
If you don't want to deal with making your own script I highly recommend Backrest, it handles everything you listed for you using Restic.
I was going to give some suggestions, but it's easiest to say it like this:
if ( ! test -d ~/Backups ) ; then exit; fi
cd ~/Backups
count=`ls -d Main-* | wc -l`
if [ count -gt 11] ; then
rm -rf `ls -rtd Main-* | head -$((count - 11))`
fi
rsync -aL ~/Main Main-`date -Ihours`
You'd run something like that every six hours. Don't expect it to work, but maybe it could help get you started.
By the way, don't forget to make a good backup before you start messing with backup scripts. Also, if the reason you're keeping twelve different backups is to see how things changed over time, put it in git instead.
this post was submitted on 16 May 2025
8 points (90.0% liked)
Linux
7377 readers
198 users here now
A community for everything relating to the GNU/Linux operating system
Also check out:
Original icon base courtesy of lewing@isc.tamu.edu and The GIMP
founded 2 years ago
MODERATORS