Always improving, never settling for good enough


It occurred to me that there was a problem with the way the backups for this website are handled.
When backups are made there is no check done to ensure that the backups don't take up too much space, and this could become troublesome.


too many backups

As you can see here, there are too many backups for this website and they were beginning to take up a lot of space, around 500 MB which is just not ideal.


a script to clean up backups

So I got to work, scripted up a quick cleanup script that checks if there are more than 10 directories in the backup folder, and deletes the first directory (oldest directory) in a loop until there are 10 or less directories.


a systemd timera systemd service

I then created a systemd timer to run at midnight every night, and for the timer, a systemd service that points at my script.

checking the systemd timer was running

After checking the status of the timer and everything seemed to be working fine.
The script was untested and I would let it run at midnight and see if it worked the next day.
Sometimes you have to fly by the seat of your pants.


it's working, 10 directories now

It worked, there are now 10 directories remaining in the backup folder.
I'm glad this went well, and I am glad you took the time to read about this.
Have a wonderful rest of your day.



You can check out a list of all the blog posts by clicking here

You can get back to the homepage by clicking here