[Borgbackup] Borgbackup] Retrieve the status (return code) of a backup?

fRANz andrea.francesconi at gmail.com
Fri Mar 27 02:56:15 EDT 2020


On Fri, Mar 27, 2020 at 12:03 AM Frédéric PAVY <frederic.pavy at free.fr> wrote:

> When I had a problem on one machine, I wasn’t able to restore the pi correctly, and after having recreated entirely the machine, I realised that the backup wasn’t complete, some files couldn’t be saved, and the backup ended with a return code of 1.
> I think it could be useful to have the information of the return code, for example in the 'borg list /path/to/repository’ command.
> But  anyway, I will improve my script, and I thing I’ll log borg’s return code after each backup, and append the log to a file on the drive containing the repository, to have a vision of this  backups

Frederic,
as Thomas suggested,
you can use --show-rc with borg create in order to get a complete
report after each backup, something like this:

####
...
Archive name: x1c7-2020-03-01T10:29:40
Archive fingerprint:
5e182c1af492f9555aa155a9593f5d0bbb677a576308c06c9aa4a5758f8f7b15
Time (start): Sun, 2020-03-01 10:29:41
Time (end):   Sun, 2020-03-01 10:29:50
Duration: 8.19 seconds
Number of files: 18973
Utilization of max. archive size: 0%
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
This archive:                2.26 GB              2.00 GB              5.41 MB
All archives:               13.09 GB             11.55 GB              1.74 GB

                       Unique chunks         Total chunks
Chunk index:                    8498               117293
------------------------------------------------------------------------------
terminating with success status, rc 0
####

The last line is the info you're looking for.
Stream/copy all the borg logs in a collector that alerts you when rc != 0
Despite the log, tests your backup with restores, this is the only safe way.

-f


More information about the Borgbackup mailing list