vps/vw/backup.sh
2023-11-22 07:26:10 +00:00

17 lines
484 B
Bash
Executable file

#!/bin/bash
if [[ $UID -ne 0 ]]; then
echo "Must be run as root."
exit 1
fi
backup_date="$(date '+%Y%m%d-%Hh%Mm')"
vw_data='/mnt/vwdata'
bak_folder="/mnt/backups/vwbackup"
mkdir -p "$bak_folder"
# Backup directement vers la storage box marche pas
sqlite3 "$vw_data/db.sqlite3" ".backup '$vw_data/db-$backup_date.sqlite3'" && echo "Vaultwarden backup created successfully!"
mv "$vw_data/db-$backup_date.sqlite3" "$bak_folder" && echo "Successfully moved backup to $bak_folder!"