mirror of
https://github.com/ViViDboarder/hassio-addon-rclone.git
synced 2024-12-22 11:37:42 +00:00
Only run timegaps on included files
This commit is contained in:
parent
7f991c490e
commit
1a340d5829
@ -1,16 +1,10 @@
|
|||||||
#! /usr/bin/with-contenv bashio
|
#! /usr/bin/with-contenv bashio
|
||||||
|
|
||||||
bashio::log.info "Configuring pruning with timegaps..."
|
|
||||||
TIMEGAPS_RULES=$(bashio::config 'prune.rules')
|
TIMEGAPS_RULES=$(bashio::config 'prune.rules')
|
||||||
TIMEGAPS_CRON=$(bashio::config 'prune.cron')
|
TIMEGAPS_CRON=$(bashio::config 'prune.cron')
|
||||||
TIMEGAPS_DELETE=""
|
|
||||||
if bashio::config.true 'prune.delete'; then
|
|
||||||
TIMEGAPS_DELETE="--delete"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$TIMEGAPS_RULES" ] && [ -n "$TIMEGAPS_CRON" ]; then
|
if [ -n "$TIMEGAPS_RULES" ] && [ -n "$TIMEGAPS_CRON" ]; then
|
||||||
COMMAND="timegaps $TIMEGAPS_DELETE $TIMEGAPS_RULES /backup/*.tar"
|
bashio::log.info "Configuring pruning with timegaps..."
|
||||||
|
echo "$TIMEGAPS_CRON /run_timegaps.sh" >> /etc/crontabs/root
|
||||||
echo "$TIMEGAPS_CRON $COMMAND" >> /etc/crontabs/root
|
|
||||||
crontab -l
|
crontab -l
|
||||||
fi
|
fi
|
||||||
|
21
rclone/rootfs/run_timegaps.sh
Executable file
21
rclone/rootfs/run_timegaps.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#! /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 \; \
|
||||||
|
| jq -r 'select(.protected) | "\(.slug).tar"' \
|
||||||
|
| timegaps --stdin $TIMEGAPS_DELETE "$TIMEGAPS_RULES"
|
||||||
|
else
|
||||||
|
timegaps $TIMEGAPS_DELETE "$TIMEGAPS_RULES"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user