hassio-addon-rclone/rclone/rootfs/run_timegaps.sh

22 lines
542 B
Bash
Raw Normal View History

2023-12-07 17:47:12 +00:00
#! /usr/bin/with-contenv bashio
set +x
set -eo pipefail
bashio::log.info "Running timegaps..."
TIMEGAPS_RULES=$(bashio::config 'prune.rules')
TIMEGAPS_DELETE=""
if bashio::config.true 'prune.delete'; then
TIMEGAPS_DELETE="--delete"
fi
if bashio::config.true 'protected_only'; then
find /backup -name "*.tar" -exec tar -xOf "{}" ./backup.json \; \
2024-02-09 19:04:30 +00:00
| jq -r 'select(.protected) | "/backup/\(.slug).tar"' \
2023-12-07 17:47:12 +00:00
| timegaps --stdin $TIMEGAPS_DELETE "$TIMEGAPS_RULES"
else
timegaps $TIMEGAPS_DELETE "$TIMEGAPS_RULES"
fi