Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# This script will stop the service, backup the data folder including
# the database, the attachments and keys of your vaultwarden installation.
# Only the last 14 backups will be kept. If you want to keep more or less, please
# adjust the time on the last line of the script
# for this script to work to work adjust the following 4 folders to your environment
# timestamp added to the backup filename e.g. 20220130-1325
NOW=$(date +'%Y%m%d-%H%M')
# the backup dir where you want to store the backups
# name of the backup file
# folder of your vaultwarden installation
# the name of the vaultwarden service
# stop the service
supervisorctl stop ${VW_SERVICE}
# create an archive in the backup folder
cd ${VW_DIR}
tar -czf ${BACKUP_DIR}/${BACKUP_ZIP} .env data
cd -
# start service again
supervisorctl start ${VW_SERVICE}
# Delete files older than 14 days
find $BACKUP_DIR -type f -mtime +13 -name \*.tgz -exec rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment