From 75760ba303ad00888acab35945da392787819863 Mon Sep 17 00:00:00 2001 From: Julien Lutran Date: Fri, 28 Aug 2026 12:53:04 +0200 Subject: [PATCH] =?UTF-8?q?restic=20scripts:=20absolute=20/usr/local/bin/r?= =?UTF-8?q?estic=20=E2=80=94=20cron=20PATH=20lacks=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First cron run (2026-08-28 05:00) failed with 'restic: command not found'; interactive shells had /usr/local/bin, cron does not. Co-Authored-By: Claude Fable 5 --- restic-backup.sh | 5 +++-- restic-incus-backup.sh | 5 +++-- restic-maintenance.sh | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/restic-backup.sh b/restic-backup.sh index dab5ac2..0ce7c8e 100755 --- a/restic-backup.sh +++ b/restic-backup.sh @@ -32,6 +32,7 @@ DB_EXCLUDE_FILE=/root/scripts/plakar-db-exclude # same opt-out list, same form DUMP_DIR=/backup/dumps LOCKFILE=/run/lock/restic-backup.lock ENVFILE=/root/.restic-env +RESTIC=/usr/local/bin/restic # cron PATH lacks /usr/local/bin STAGE=all usage() { @@ -144,14 +145,14 @@ fi # stage dumps if [ "$STAGE" = all ] || [ "$STAGE" = backup ]; then log "restic backup -> $REPO" -restic -r "$REPO" backup \ +$RESTIC -r "$REPO" backup \ --pack-size 64 --read-concurrency 8 -o s3.connections=8 \ --exclude-file "$EXCLUDE_FILE" \ --files-from-verbatim "$PATHS_FILE" "$DUMP_DIR" \ || { echo "restic backup failed" >&2; rc=1; } log "forget: keep 14d/8w/6m" -restic -r "$REPO" forget --group-by host \ +$RESTIC -r "$REPO" forget --group-by host \ --keep-daily 14 --keep-weekly 8 --keep-monthly 6 || rc=1 fi # stage backup diff --git a/restic-incus-backup.sh b/restic-incus-backup.sh index d7ddb23..7219fcb 100755 --- a/restic-incus-backup.sh +++ b/restic-incus-backup.sh @@ -31,6 +31,7 @@ ONLY_INSTANCES="" MNT_ROOT=/run/restic-incus LOCKFILE=/run/lock/restic-incus-backup.lock ENVFILE=/root/.restic-env +RESTIC=/usr/local/bin/restic # cron PATH lacks /usr/local/bin MOUNT_TIMEOUT=30 usage() { @@ -105,7 +106,7 @@ for inst in $(incus list --project "$PROJECT" -c n -f csv); do fi log "backup $inst" - restic -r "$REPO" backup \ + $RESTIC -r "$REPO" backup \ --pack-size 64 --read-concurrency 8 -o s3.connections=8 \ --tag "$inst" "$mnt" "$MNT_ROOT/$inst.yaml" \ || { echo "backup of $inst failed" >&2; rc=1; } @@ -114,7 +115,7 @@ for inst in $(incus list --project "$PROJECT" -c n -f csv); do done log "forget: keep 14d/8w/6m" -restic -r "$REPO" forget --keep-daily 14 --keep-weekly 8 --keep-monthly 6 || rc=1 +$RESTIC -r "$REPO" forget --keep-daily 14 --keep-weekly 8 --keep-monthly 6 || rc=1 log "done (rc=$rc)" exit $rc diff --git a/restic-maintenance.sh b/restic-maintenance.sh index 46021ea..9af4841 100755 --- a/restic-maintenance.sh +++ b/restic-maintenance.sh @@ -17,6 +17,7 @@ set -u REPOS="s3:s3.sbg.io.cloud.ovh.net/restic-data,s3:s3.sbg.io.cloud.ovh.net/restic-incus" LOCKFILE=/run/lock/restic-maintenance.lock ENVFILE=/root/.restic-env +RESTIC=/usr/local/bin/restic # cron PATH lacks /usr/local/bin while getopts r: flag; do case "${flag}" in @@ -42,11 +43,11 @@ WEEK=$(( ($(date +%s) / 604800) % 52 + 1 )) rc=0 for repo in $(printf '%s' "$REPOS" | tr ',' ' '); do log "maintenance: $repo" - restic -r "$repo" unlock || rc=1 - restic -r "$repo" prune --max-unused 10% --max-repack-size 4G --pack-size 64 || rc=1 - restic -r "$repo" check || rc=1 + $RESTIC -r "$repo" unlock || rc=1 + $RESTIC -r "$repo" prune --max-unused 10% --max-repack-size 4G --pack-size 64 || rc=1 + $RESTIC -r "$repo" check || rc=1 log "check --read-data-subset=$WEEK/52" - restic -r "$repo" check --read-data-subset="$WEEK/52" || rc=1 + $RESTIC -r "$repo" check --read-data-subset="$WEEK/52" || rc=1 done log "done (rc=$rc)"