Table of Contents
rsnapshot-backup / development
error handling
STDOUT
The messages which are printed to stdout by rsync are directed to a log file by rsnapshot.
The name of the log file follows the entry logfile
in the config file for the backup job.
It defaults to /var/log/rsnapshot-backup/<systemname>/log
which is renamed to
/var/log/rsnapshot-backup/<systemname>/log-<YYYYmmdd-HHMMSS>
after the backup
job is completed.
STDERR
Unfortunately, rsnapshot lets escape rsync's stderr messages without recording them. So they would end up on your terminal or most likely are cought by cron and sent per email.
Rsnapshot-backup intercepts rsnapshot's stderr and redirects the message to
a file which name is derived from the logfile
entry
in the config file for the backup job.
It defaults to /var/log/rsnapshot-backup/<systemname>/log-error
which is renamed to
/var/log/rsnapshot-backup/<systemname>/log-error-<YYYYmmdd-HHMMSS>
after the backup
job is completed.
The -error
part of the file name is not configurable.
If there is no output on stderr there will be no log-error-*
file.
The time stamps in the file names are identical for log-*
and log-error-*
so
the two corresponding log files can be matched easily.
how to provoke an error for testing
mkdir /root/tmp cd /root/tmp while sleep 0.05 ; do ( F=$( mktemp xxx-$( date -Is )-XXXXXX ) ; date > $F; sleep 0.2 ; rm $F ) & done
This creates 20 files per second which are removed after 200ms.
The error provoked would be something like:
------ BACKUP OF '/etc/rsnapshot-backup.d/enabled/conf.vstest01' ------ file has vanished: "/root/tmp/xxx-2017-06-27T14:13:50+0000-STgDmA" rsync warning: some files vanished before they could be transferred (code 24) at main.c(1655) [generator=3.1.1] ----------------------------