Skip to content
Snippets Groups Projects

WIP: Add initial restic support.

Closed Christopher Gervais requested to merge ergonlogic/backupninja:dev/restic into master
2 unresolved threads
+ 18
42
@@ -116,50 +116,26 @@ if [[ "$retention" == "yes" ]]; then
@@ -116,50 +116,26 @@ if [[ "$retention" == "yes" ]]; then
fi
fi
fi
fi
if [ $keep_hourly ]; then
declare -A range_array
if [[ $keep_hourly =~ ^[0-9]+$ ]]; then
range_array['hourly']="hour"
debug "==> For the last $keep_hourly hours in which a snapshot was made, keep only the last snapshot for each hour."
range_array['daily']="day"
keep_options="$keep_options --keep-hourly $keep_hourly"
range_array['weekly']="week"
else
range_array['monthly']="month"
fatal "If 'keep_hourly' is set, it must be an integer."
range_array['yearly']="year"
 
 
for range in "${!range_array[@]}" ; do
 
keep_range="keep_${range}"
 
keep_unit="${range_array[$range]}"
 
if [ "${!keep_range}" ]; then
 
if [[ "${!keep_range}" =~ ^[0-9]+$ ]]; then
 
debug "==> For the last ${!keep_range} ${keep_unit}s in which a snapshot was made, keep only the last snapshot for each ${keep_unit}."
 
keep_options="$keep_options --keep-$range ${!keep_range}"
 
else
 
fatal "If 'keep_$range' is set, it must be an integer."
 
fi
fi
fi
fi
if [ $keep_daily ]; then
done
if [[ $keep_daily =~ ^[0-9]+$ ]]; then
debug "==> For the last $keep_daily days which have one or more snapshots, only keep the last one for that day."
keep_options="$keep_options --keep-daily $keep_daily"
else
fatal "If 'keep_daily' is set, it must be an integer."
fi
fi
if [ $keep_weekly ]; then
if [[ $keep_weekly =~ ^[0-9]+$ ]]; then
debug "==> For the last $keep_weekly weeks which have one or more snapshots, only keep the last one for that week."
keep_options="$keep_options --keep-weekly $keep_weekly"
else
fatal "If 'keep_weekly' is set, it must be an integer."
fi
fi
if [ $keep_monthly ]; then
if [[ $keep_monthly =~ ^[0-9]+$ ]]; then
debug "==> For the last $keep_monthly months which have one or more snapshots, only keep the last one for that month."
keep_options="$keep_options --keep-monthly $keep_monthly"
else
fatal "If 'keep_monthly' is set, it must be an integer."
fi
fi
if [ $keep_yearly ]; then
if [[ $keep_yearly =~ ^[0-9]+$ ]]; then
debug "==> For the last $keep_yearly years which have one or more snapshots, only keep the last one for that year."
keep_options="$keep_options --keep-yearly $keep_yearly"
else
fatal "If 'keep_yearly' is set, it must be an integer."
fi
fi
if [ $keep_tag ]; then
if [ $keep_tag ]; then
for tag in $keep_tag
for tag in $keep_tag
Loading