From 68fa93f34f051bbbd4542da3c2dd0f76b12e3f1f Mon Sep 17 00:00:00 2001 From: Jeffrey Serio Date: Wed, 26 Feb 2025 21:54:23 -0600 Subject: [PATCH] Use argument list as array items --- backup_podman_volumes | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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