diff --git a/backup_podman_volumes b/backup_podman_volumes index a9a987b..4d6a1a7 100755 --- a/backup_podman_volumes +++ b/backup_podman_volumes @@ -2,19 +2,21 @@ set -euo pipefail +if [ "$#" -eq 0 ]; then + echo "Enter one or more Podman volume names." + exit 1 +fi + BACKUP_DIR="${HOME}/podman_volume_backups" DATE=$(date '+%Y-%m-%d_%H%M%S') -volumes=( - "grafana-storage" - "semaphore_semaphore-mysql" -) +volumes=("$@") for vol in "${volumes[@]}"; do podman volume export "$vol" --output "${BACKUP_DIR}/${vol}-${DATE}.tar" gzip "${BACKUP_DIR}/${vol}-${DATE}.tar" done -find "$BACKUP_DIR" -maxdepth 1 -mtime +7 -type f -delete +find "$BACKUP_DIR" -maxdepth 1 -mtime +3 -type f -delete exit 0