Adds cron tag depending on execution

This commit is contained in:
Matthias Leutenegger 2019-08-14 16:16:16 +02:00
parent d727654d27
commit d6bb19bf1a

View file

@ -49,12 +49,17 @@ BACKUP_SOURCE={{ item.src }}
{#
Define backup commands
#}
if [[ -z ${CRON+x} ]]; then
MODE_TAG="--tag manual"
else
MODE_TAG="--tag cron"
fi
{% if item.stdin is defined and item.stdin == true %}
{{ item.stdin_cmd }} | {{ restic_install_path }}/restic backup --stdin --tag manual {{ tags(item.tags) }} {{ stdin_filename(item.stdin_filename) }} $@
{{ item.stdin_cmd }} | {{ restic_install_path }}/restic backup --stdin $MODE_TAG {{ tags(item.tags) }} {{ stdin_filename(item.stdin_filename) }} $@
{% else %}
{{ restic_install_path }}/restic backup $BACKUP_SOURCE --tag manual {{ tags(item.tags) }} $@
{{ restic_install_path }}/restic backup $BACKUP_SOURCE $MODE_TAG {{ tags(item.tags) }} $@
{% endif %}
{#
Define stdin forget commands
#}
{{ restic_install_path }}/restic forget --prune --tag manual --path {{ path(item) }} {{ retention_pattern(item) }}
{{ restic_install_path }}/restic forget --path {{ path(item) }} {{ retention_pattern(item) }}