restic scripts: absolute /usr/local/bin/restic — cron PATH lacks it
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c5c958f511
commit
75760ba303
@@ -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)"
|
||||
|
||||
Reference in New Issue
Block a user