Confluence 4.0 : User Submitted Backup & Restore Scripts
This page last changed on Jun 03, 2011 by edawson.
These scripts are user-submitted and should be used with caution as they are not covered by Atlassian technical support. If you have questions on how to use or modify these scripts, please post them to Atlassian Answers. Feel free to submit new scripts or post updates by logging in and adding them to the page as a comment. Delete Old Backups - Wscript Script On WindowsThis script examines backup filename and deletes them if necessary, it may need to be edited. 'If you want 3 day old files to be deleted then insert 3 next to Date - "your number here" 'This script will search out and delete files with this string in them ".2005-12-04-" This of course depends on the number you enter. 'You can always do a wscript.echo strYesterday or strFileName to see what the script thinks you are searching for. dtmYesterday = Date - 3 strYear = Year(dtmYesterday) strMonth = Month(dtmYesterday) If Len(strMonth) = 1 Then strMonth = "0" & strMonth End If strDay = Day(dtmYesterday) If Len(strDay) = 1 Then strDay = "0" & strDay End If strYesterday = strYear & "-" & strMonth & "-" & strDay strFileName = "C:\test*." & strYesterday &"-*" Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.DeleteFile(strFileName) Delete Old Backups - Basic Bash Script For LinuxOld XML backups can be deleted automatically by inserting a nightly or weekly automation script or cron similar to the following: ls -t <path to your backup dir>/* | tail -n +6 | xargs -i rm {} Or, using the older form of the ls -t <path to your backup dir>/* | tail +6 | xargs -i rm {} Delete Old Backups - Advanced Bash Script For LinuxOld XML backups can be deleted automatically by inserting a nightly or weekly automation script or cron similar to the following. Set the BACKUP_DIR and DAYS_TO_RETAIN variables to appropriate values for your site. Between runs, more files than DAYS_TO_RETAIN builds up. #!/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 Manual Database & Home Backup - Bash Script For LinuxThis backs up a mySQL database and the Confluence home directory. #!/bin/bash CNFL=/var/confluence CNFL_BACKUP=/backup/cnflBackup/`date +%Y%m%d-%H%M%S` rm -rf $CNFL/temp/* mkdir $CNFL_BACKUP mysqldump -uroot -p<password> confluence|gzip > $CNFL_BACKUP/confluence.mysql.data.gz tar -cjvf $CNFL_BACKUP/data.bzip $CNFL > $CNFL_BACKUP/homedir.status Backup by Date - Postgresexport d=`date +%u` mkdir -p /home/backup/postgres/$d sudo -u postgres pg_dumpall | bzip2 > /home/backup/postgres/$d/sql.bz2 Related Topics |
![]() |
Document generated by Confluence on Sep 19, 2011 02:38 |