2
0
Fork 0
main
Ducky 2023-08-21 21:07:45 +01:00
parent 4707b00867
commit 439e69fb78
1 changed files with 20 additions and 10 deletions

View File

@ -225,20 +225,30 @@ download_restic 0.16.0
test_file "$restic_repo_file"
test_file "$restic_repo_passwd_file"
if [[ -z "$1" ]]; then
say info "Running backup scripts..."
if [[ -z "$1" || -f "$1" ]]; then
if [[ -z "$1" ]]; then
say info "Running backup scripts..."
if ! [[ "$(ls -A $backup_scripts_dir)" ]]; then
die "No scripts found in '$backup_scripts_dir'"
if ! [[ "$(ls -A $backup_scripts_dir)" ]]; then
die "No scripts found in '$backup_scripts_dir'"
fi
for backup_script in $backup_scripts_dir/*; do
invoke_script $backup_script
done
else
say info "Running script: $(basename "$1")"
invoke_script "$1"
fi
for backup_script in $backup_scripts_dir/*; do
invoke_script $backup_script
done
say primary "$(repeat "-" 80)"
elif [[ -f "$1" ]]; then
invoke_script "$1"
invoke_restic snapshots \
--compact \
--latest 1 \
--host "$host" \
--tag "$(basename "$0")" \
| sed -E ":begin;$!N;s/$(basename "$0")\n\s+?//;tbegin;P;D"
else
command="$1"
arguments="${@:2}"