Deleting old Confluence backup files
After I installed the Confluence wiki, I discovered I need to do at least one thing to maintain it. By default, Confluence makes a backup of the site every morning at 2 a.m. The files will keep building up unless you do something about it. On a small Confluence site like mine, it would take a couple of years to fill the disk. But in case your site is large and you haven’t already put something in place to prune the older backup files, here’s a simple Unix shell script you can add to your Cron configuration.
#!/bin/sh # Script to remove the older Confluence backup files. # Currently we retain at least the last two weeks worth # of backup files in order to restore if needed. BACKUP_DIR="/data/web/confluence/backups" DAYS_TO_RETAIN=14 find $BACKUP_DIR -maxdepth 1 -type f -ctime +$DAYS_TO_RETAIN -delete
Confluence backs up the site to a backups
subdirectory.
You can tell where that is (and change it if you want) under your
Administration -> Daily Backup Admin
page.
I put this script on my Linux box in the /etc/cron.weekly
directory.
Since I run the script only weekly,
more files will build up than defined by the DAYS_TO_RETAIN
variable,
but my Confluence site is small and this doesn’t matter to me.
If your site is larger, you might want to put the script under
/etc/cron.daily
.
Confluence uses Quartz to schedule backups, so if you want to change the time from 2 a.m. (or make backups less or more frequent), see the Confluence Changing time of Daily Backup page for instructions.