List of restic exit codes? (checking if repo is locked)

Hello,

is there a list of exit codes of the different functions, like for stats, check and snapshots? I try to test in a script, if a backup is locked.

Thanks.

1 Like

Each of the verbs’ --help texts explain the possible exit codes.

Also you might want to check this github issue: https://github.com/restic/restic/issues/956

1 Like

Hi I ended up with this script to sync check locks.
Alternatively you can use restic copy instead of rclone copy.

count=5
path="/mnt/data/locks"
lockcheck=$(/usr/bin/rclone lsf $path |head)
until [[ -z $lockcheck ]] || [ $count == 0 ]
do
	echo "Checking if repository is locked"
	/usr/local/bin/restic unlock
	count=$((count-1))
	echo "value of count = $count"
	sleep 600 #waiting for 10 minutes each time.
	lockcheck=$(/usr/bin/rclone lsf $path |head)
done
if [ -z $lockcheck ]
then
	sleep 10
	echo "All OK in repository"
	/usr/bin/rclone copy -Pv /mnt/data/ s3-bucket:restic --log-file $logfile
	/usr/bin/sendEmail ................ #send email alert all ok
	#echo "value of count = $count"
	sleep 5
else
	sleep 10
	clock=$(date +"%T")
	#sending timout email alert
	echo "Timeout to unlock repository $clock"
	/usr/bin/sendEmail ........- Timeout email 
	/usr/bin/rclone copy -Pv /mnt/data/ s3-bucket:restic --log-file $logfile
	#sending email report of partial uploads
	/usr/bin/sendEmail............ email alert partial synced
	#echo "value of count = $count"
	sleep 5
fi

Hope it helps someone :slight_smile:

1 Like