Swap deprecated --last option with --latest 1

This commit is contained in:
2026-09-22 15:35:39 -04:00
parent 9c26a0c48e
commit c6e2736cd1
+11 -11
View File
@@ -22,7 +22,7 @@ COMPRESSION="auto"
# Function to display usage
usage() {
cat << EOF
cat <<EOF
Usage: $0 [OPTIONS] <source_path> <repository>
Generic backup script using Restic for any folder and repository.
@@ -90,7 +90,7 @@ log_message() {
fi
if [ -n "$LOG_FILE" ]; then
echo "$message" >> "$LOG_FILE"
echo "$message" >>"$LOG_FILE"
fi
}
@@ -111,7 +111,7 @@ send_healthcheck() {
"SUCCESS")
curl -fsS -m 10 --retry 3 --data-raw "$message" "$HEALTHCHECK_URL" >/dev/null 2>&1 || true
;;
"FAILED"|"WARNING")
"FAILED" | "WARNING")
curl -fsS -m 10 --retry 3 --data-raw "$message" "$HEALTHCHECK_URL/fail" >/dev/null 2>&1 || true
;;
esac
@@ -126,19 +126,19 @@ POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do
case $1 in
-p|--password-file)
-p | --password-file)
RESTIC_PASSWORD_FILE="$2"
shift 2
;;
-l|--log-file)
-l | --log-file)
LOG_FILE="$2"
shift 2
;;
-h|--healthcheck)
-h | --healthcheck)
HEALTHCHECK_URL="$2"
shift 2
;;
-t|--tag)
-t | --tag)
CUSTOM_TAGS+=("$2")
shift 2
;;
@@ -162,7 +162,7 @@ while [[ $# -gt 0 ]]; do
KEEP_YEARLY="$2"
shift 2
;;
-e|--exclude)
-e | --exclude)
EXCLUDE_PATTERNS+=("$2")
shift 2
;;
@@ -176,7 +176,7 @@ while [[ $# -gt 0 ]]; do
;;
--compression)
case "$2" in
auto|max|off|fastest|better)
auto | max | off | fastest | better)
COMPRESSION="$2"
;;
*)
@@ -190,7 +190,7 @@ while [[ $# -gt 0 ]]; do
DRY_RUN=true
shift
;;
-v|--verbose)
-v | --verbose)
VERBOSE=true
shift
;;
@@ -294,7 +294,7 @@ send_healthcheck "START" "Starting backup of $BACKUP_NAME"
# Pre-backup: Check repository connectivity
log_message "Checking repository connectivity..."
CONNECTIVITY_OUTPUT=""
if ! CONNECTIVITY_OUTPUT=$(eval "$RESTIC_CMD snapshots --last" 2>&1); then
if ! CONNECTIVITY_OUTPUT=$(eval "$RESTIC_CMD snapshots --latest 1" 2>&1); then
log_message "WARNING: Could not connect to repository or no snapshots exist yet"
if [ "$VERBOSE" = true ]; then
log_message "Connectivity check output: $CONNECTIVITY_OUTPUT"