Saving more log for restic backup when getting status code 3

Hi, I have created a shell script for the restic backup and set a cron job to run the shell script. It recently returned the exit status code 3 after the backup.
In the shell script, it runs the backup and check the exit status code as follow and the result is saved in a file:

echo sudo -u restic /home/restic/bin/restic -r $backup_repo_path --verbose backup $backup_item_path >> $output_file
echo “Exit status code : $?” >> $output_file

When I got the exit status code 3, I tried to check the ouput file but I cannot get hints on why it is returning the exit status code 3. The information for the backup saved in the file is as follow:
open repository
reading repository password from stdin
lock repository
load index files
using parent snapshot 40e1709c
start scan on [/path/to/backup]
start backup on [/path/to/backup]
scan finished in 20.170s: 3490 files, 527.915 MiB

Files: 0 new, 3486 changed, 0 unmodified
Dirs: 0 new, 1063 changed, 0 unmodified
Data Blobs: 8 new
Tree Blobs: 1050 new
Added to the repo: 4.001 MiB

processed 3486 files, 527.824 MiB in 0:45
snapshot 4bdcb0a2 saved
Exit status code : 3

May I know how to save more information about the backup and check for the data that are not read? Thanks.

You might want to save the stderr too:

echo sudo -u restic /home/restic/bin/restic -r $backup_repo_path --verbose backup $backup_item_path >> $output_file 2>&1
1 Like

Thanks. I am able to get more information now. Is it possible to check the information for the previous backup that run several days ago?
Thanks.

Usually, anything sent to stderr when started from cron should be emailed to the user.

Right, I might be old fashion and maybe cron is no longer setup like that :smile:

In which case you should get the output of stderr logged somewhere. You might want to check your system logs.