-
Notifications
You must be signed in to change notification settings - Fork 6
Backup
To make a backup of a Sausagewiki instance, you only need to make a copy of the database file in question. (For example /var/lib/sausagewiki/sausagewiki.db
)
However, SQLite is not immune to corruption due to changes happening while copying the database file. For now, it is therefore recommended that you terminate Sausagewiki before making a backup (but see issue #48).
If you don't have a working backup system already, a simple scheme could be implemented with logrotate
. This example assumes you manage your Sausagewiki instance with systemd. Create /etc/logrotate.d/sausagewiki
:
/var/lib/sausagewiki/sausagewiki.db {
compress
compresscmd /usr/bin/xz
uncompresscmd /usr/bin/unxz
compressext .xz
copy
rotate 7
daily
olddir /var/lib/sausagewiki-backup
dateext
extension .db
prerotate
/bin/systemctl stop sausagewiki
endscript
postrotate
/bin/systemctl start sausagewiki
endscript
}
Logrotate is picky about the file mode of the conf file: chmod 644 /etc/logrotate.d/sausagewiki
And it will not create missing directories: mkdir /var/lib/sausagewiki-backup
Do a dry-run to see that everything seems in order: logrotate -d /etc/logrotate.d/sausagewiki
From now on, your Sausagewiki instance should be automatically backed up into /var/lib/sausagewiki-backup/
every night, keeping the 7 last copies. These files are not in use by any process and can be copied to other media (for example with rsync
) without further consideration.