1

I have hourly, daily, weekly etc. backups of a mysql database run by rsnapshot. These are running regularly, but on the wrong schedule.

Here are the contents of /etc/cron.d/rsnapshot:

5       *       * * *           root    /usr/bin/rsnapshot hourly
30      0       * * *           root    /usr/bin/rsnapshot daily
35      12      * * 0           root    /usr/bin/rsnapshot weekly
40      13      1 * *           root    /usr/bin/rsnapshot monthly
45      0       1 1 *           root    /usr/bin/rsnapshot yearly

However when I check the resulting files, it appears that the snapshots are being taken according to the 'hourly' schedule. For example, the daily.0 backup is named: /backups/daily.0/mysql/2021-01-02_22h05m01s_UTC-db_dump.sql.gz You can see that that file was created at 5 minutes past the hour.

Why is the daily job, which is supposed to run at 00:30am each day, running at 5 minutes past the hour?

Of relevance may be this part of my /etc/rsnapshot.conf:

retain  hourly  3
retain  daily   7
retain  weekly  4
retain  monthly 12
retain  yearly  100
Kit Johnson
  • 131
  • 5

1 Answers1

2

From the docs:

When configuring [the retain intervals in /etc/rsnapshot.conf], note that the first in the list will be the only one that actually backs up files from the file system AND rotates its own previous backups. The rest will ONLY rotate previous backups, creating its newest backup from the oldest backup created by the previous item on the list. So, the order these are listed in the config file are very important.

For this reason, the actual database backup dumps will only ever be the ones created by the most frequent interval, in this case 'hourly'. Since in your example the cron job runs 'hourly' at five minutes past the hour, all greater intervals (even monthly) will end up retaining backups that were created at five minutes past the hour.

Kit Johnson
  • 131
  • 5