#!/bin/bash # Backup script for Calibre-web in a kubernetes cluster BACKUP_DEST="/mnt/PRIVATE_DOCS/BACKUPS/calibre-web" DATABASE_FILE="/config/app.db" backup_filename="calibre-web-app_$(date +'%Y%m%d').db" # 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" docker cp "${base_container}":"${DATABASE_FILE}" "${BACKUP_DEST}/${backup_filename}" >&2 echo "Done"