Use argument list as array items
This commit is contained in:
parent
7ceb3c4440
commit
68fa93f34f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user