Hugo/backups/create_calibre-web_backup.sh

20 lines
539 B
Bash
Raw Normal View History

2023-06-15 20:56:48 +02:00
#!/bin/bash
# Backup script for Calibre-web in a kubernetes cluster
BACKUP_DEST="/mnt/PRIVATE_DOCS/BACKUPS/calibre-web"
2023-06-15 22:25:10 +02:00
DATABASE_FILE="/config/app.db"
backup_filename="calibre-web-app_$(date +'%Y%m%d').db"
2023-06-15 20:56:48 +02:00
# Retrieve container name
base_container=$( docker ps --format "{{.Names}}" | grep tkioskje-calibre-web_tkioskje-calibre-web )
# Abort entire script if any command fails
set -e
# Database backup
>&2 echo "Backing up database"
2023-06-15 22:25:10 +02:00
docker cp "${base_container}":"${DATABASE_FILE}" "${BACKUP_DEST}/${backup_filename}"
2023-06-15 20:56:48 +02:00
>&2 echo "Done"