Hi all:
First… thanks for your support and your excellent Restic tool.
I’m doing backups with a bash script that works fine when it’s launched manually, but not when it’s under Cron. I already fixed some issues related to permissions on OSx / Cron and so on… but still I have some fatal errors on Restic.
This is my environment:
Restic:
restic 0.12.1 compiled with go1.16.6 on darwin/amd64
OS:
ProductName: Mac OS X
ProductVersion: 10.15.7
BuildVersion: 19H1323
Backup to Google Drive via Rclone (works fine… I already tested).
This is my Script
#!/bin/sh
#Variables
now=$(date +%s)
start=$(date +%s)
#Cleaning Backups
find ~/Backup -name ‘.DS_Store’ -type f -delete > /dev/null 2>&1
#Cleaninig Restic Snapshots
/usr/local/bin/restic cache --cleanup > /dev/null 2>&1
echo “restic outputs for <>” $? >> ~/System_Scripts/error.log
##Forget old snapshots
/usr/local/bin/restic --password-file ~/.pera -r rclone:gdrive:1 forget --keep-last 30 --prune > /dev/null 2>&1
echo “restic outputs for <>” $? >> ~/System_Scripts/error.log
##Doing backups
#Backup Borg
export BORG_PASSPHRASE=$(cat ~/.melocoton)
/usr/local/bin/borg create ~/Backup_enc::$(date ‘+%A-%d-%B-%y-%T’) ~/1 --show-rc --compression auto,lzma,6 2>> ~/System_Scripts/error.log
export BORG_PASSPHRASE=""
#Backup Restic
/usr/local/bin/restic --password-file ~/.pera -r rclone:gdrive:1 backup ~/Backup_enc/ >> ~/System_Scripts/error.log
echo “restic outputs for <>” $? >> ~/System_Scripts/error.log
#Backup Output
finish=$(date +%s)
elapse=$((finish - start))
printf “\n >>>>>>>>> Executed in $elapse secs at $(date). Done Backup”
printf “\n >>>>>>>>> Executed in $elapse secs at $(date). Done Backup” >> ~/System_Scripts/backup.log
I launched backup.sh manually (the first time), after… cron execs it.
This is the backup log:
Executed in 35 secs at Sat Sep 4 11:04:21 CEST 2021. Done Backup
Executed in 7 secs at Sat Sep 4 11:15:07 CEST 2021. Done Backup
Executed in 7 secs at Sat Sep 4 11:30:07 CEST 2021. Done Backup
Executed in 6 secs at Sat Sep 4 11:45:06 CEST 2021. Done Backup
(the first one works… 35 secs …all good) The others did not.
This is the error.log:
restic outputs for <> 0
restic outputs for <> 0
terminating with success status, rc 0
using parent snapshot adfe8076
Files: 8 new, 1 changed, 509 unmodified
Dirs: 1 new, 5 changed, 0 unmodified
Added to the repo: 1.842 MiB
processed 518 files, 5.427 GiB in 0:13
snapshot b90504b9 saved
restic outputs for <> 0
restic outputs for <> 0
restic outputs for <> 1
terminating with success status, rc 0
restic outputs for <> 1
restic outputs for <> 0
restic outputs for <> 1
terminating with success status, rc 0
restic outputs for <> 1
restic outputs for <> 0
restic outputs for <> 1
terminating with success status, rc 0
restic outputs for <> 1
As you can see, only works fine on the first. After, Backup and delete old snapshots returns Error code 1.
Any help?
Thanks
Summary
This text will be hidden