I am running restic as a user which has the timezone set in .profile
. I have it set with a cron job to backup on every 2nd hour of the day (starting from 00:00 for a total of 12 backups per day).
Here is the result of checking the user’s timezone:
user:~$ echo $TZ
America/New_York
user:~$ date +'%:z %Z'
-04:00 EDT
For the server I am on, the result of cat /etc/timezone
is Europe/Amsterdam
.
Here are my current snapshots as of ~21:00 EDT (host and user are replaced for privacy):
ID Time Host Tags Paths
------------------------------------------------------------------------------
4adbb205 2021-09-26 12:25:02 host cron /home2/user
4a2741a1 2021-09-26 14:00:02 host cron /home2/user
b23cefc7 2021-09-26 16:00:02 host cron /home2/user
3f74ebd8 2021-09-26 18:00:03 host cron /home2/user
8bec14db 2021-09-26 20:00:01 host cron /home2/user
78548708 2021-09-26 22:00:01 host cron /home2/user
31b82bf6 2021-09-27 00:00:01 host cron /home2/user
d66af2fa 2021-09-27 02:00:02 host cron /home2/user
4f0054e6 2021-09-27 04:00:02 host cron /home2/user
11e5e4aa 2021-09-27 06:00:01 host cron /home2/user
9ebe7f06 2021-09-27 08:00:02 host cron /home2/user
d2c3be83 2021-09-27 10:00:02 host cron /home2/user
16ee3e87 2021-09-27 12:00:01 host cron /home2/user
59322eff 2021-09-27 14:00:02 host cron /home2/user
6df60ecf 2021-09-27 16:00:02 host cron /home2/user
152ede11 2021-09-27 18:00:02 host cron /home2/user
1525d1ae 2021-09-27 20:00:02 host cron /home2/user
9f60a69d 2021-09-27 22:00:01 host cron /home2/user
24f496bd 2021-09-28 00:00:02 host cron /home2/user
6d3039c5 2021-09-28 02:00:01 host cron /home2/user
8f50284a 2021-09-28 04:00:02 host cron /home2/user
9b4199c5 2021-09-28 06:00:01 host cron /home2/user
4b89aff8 2021-09-28 08:00:02 host cron /home2/user
c3f8253e 2021-09-28 10:00:02 host cron /home2/user
5ddf95ba 2021-09-28 12:00:02 host cron /home2/user
08b6c41a 2021-09-28 14:00:02 host cron /home2/user
181eaf5d 2021-09-28 16:00:02 host cron /home2/user
4dc103df 2021-09-28 18:00:02 host cron /home2/user
4dcadc88 2021-09-28 20:00:01 host cron /home2/user
My intent with the forget policy is to always keep the last 24 hours of backups, and keep a daily back up going back two days. If I test this forget policy it for some reason keeps 2 dailies in rather close proximity, and 2 days back it does not keep a backup as I would expect:
user:~$ restic forget --dry-run --keep-within 24h --keep-daily 2
keep 13 snapshots:
ID Time Host Tags Reasons Paths
---------------------------------------------------------------------------------------------------------
1525d1ae 2021-09-27 20:00:02 host cron within 24h /home2/user
9f60a69d 2021-09-27 22:00:01 host cron within 24h /home2/user
24f496bd 2021-09-28 00:00:02 host cron within 24h /home2/user
6d3039c5 2021-09-28 02:00:01 host cron within 24h /home2/user
8f50284a 2021-09-28 04:00:02 host cron within 24h /home2/user
9b4199c5 2021-09-28 06:00:01 host cron within 24h /home2/user
4b89aff8 2021-09-28 08:00:02 host cron within 24h /home2/user
c3f8253e 2021-09-28 10:00:02 host cron within 24h /home2/user
5ddf95ba 2021-09-28 12:00:02 host cron within 24h /home2/user
08b6c41a 2021-09-28 14:00:02 host cron within 24h /home2/user
181eaf5d 2021-09-28 16:00:02 host cron within 24h /home2/user
daily snapshot
4dc103df 2021-09-28 18:00:02 host cron within 24h /home2/user
4dcadc88 2021-09-28 20:00:01 host cron within 24h /home2/user
daily snapshot
---------------------------------------------------------------------------------------------------------
13 snapshots
remove 16 snapshots:
ID Time Host Tags Paths
-----------------------------------------------------------------------------------------
4adbb205 2021-09-26 12:25:02 host cron /home2/user
4a2741a1 2021-09-26 14:00:02 host cron /home2/user
b23cefc7 2021-09-26 16:00:02 host cron /home2/user
3f74ebd8 2021-09-26 18:00:03 host cron /home2/user
8bec14db 2021-09-26 20:00:01 host cron /home2/user
78548708 2021-09-26 22:00:01 host cron /home2/user
31b82bf6 2021-09-27 00:00:01 host cron /home2/user
d66af2fa 2021-09-27 02:00:02 host cron /home2/user
4f0054e6 2021-09-27 04:00:02 host cron /home2/user
11e5e4aa 2021-09-27 06:00:01 host cron /home2/user
9ebe7f06 2021-09-27 08:00:02 host cron /home2/user
d2c3be83 2021-09-27 10:00:02 host cron /home2/user
16ee3e87 2021-09-27 12:00:01 host cron /home2/user
59322eff 2021-09-27 14:00:02 host cron /home2/user
6df60ecf 2021-09-27 16:00:02 host cron /home2/user
152ede11 2021-09-27 18:00:02 host cron /home2/user
-----------------------------------------------------------------------------------------
16 snapshots
I thought maybe I was misunderstanding keep-daily and tried keep-within-daily 2d
but it still does not give me the result I was expecting:
keep 14 snapshots:
ID Time Host Tags Reasons Paths
----------------------------------------------------------------------------------------------------------
6df60ecf 2021-09-27 16:00:02 host cron daily within 2d /home2/user
1525d1ae 2021-09-27 20:00:02 host cron within 24h /home2/user
9f60a69d 2021-09-27 22:00:01 host cron within 24h /home2/user
24f496bd 2021-09-28 00:00:02 host cron within 24h /home2/user
6d3039c5 2021-09-28 02:00:01 host cron within 24h /home2/user
8f50284a 2021-09-28 04:00:02 host cron within 24h /home2/user
9b4199c5 2021-09-28 06:00:01 host cron within 24h /home2/user
4b89aff8 2021-09-28 08:00:02 host cron within 24h /home2/user
c3f8253e 2021-09-28 10:00:02 host cron within 24h /home2/user
5ddf95ba 2021-09-28 12:00:02 host cron within 24h /home2/user
08b6c41a 2021-09-28 14:00:02 host cron within 24h /home2/user
181eaf5d 2021-09-28 16:00:02 host cron within 24h /home2/user
daily within 2d
4dc103df 2021-09-28 18:00:02 host cron within 24h /home2/user
4dcadc88 2021-09-28 20:00:01 host cron within 24h /home2/user
daily within 2d
----------------------------------------------------------------------------------------------------------
14 snapshots
remove 15 snapshots:
ID Time Host Tags Paths
-----------------------------------------------------------------------------------------
4adbb205 2021-09-26 12:25:02 host cron /home2/user
4a2741a1 2021-09-26 14:00:02 host cron /home2/user
b23cefc7 2021-09-26 16:00:02 host cron /home2/user
3f74ebd8 2021-09-26 18:00:03 host cron /home2/user
8bec14db 2021-09-26 20:00:01 host cron /home2/user
78548708 2021-09-26 22:00:01 host cron /home2/user
31b82bf6 2021-09-27 00:00:01 host cron /home2/user
d66af2fa 2021-09-27 02:00:02 host cron /home2/user
4f0054e6 2021-09-27 04:00:02 host cron /home2/user
11e5e4aa 2021-09-27 06:00:01 host cron /home2/user
9ebe7f06 2021-09-27 08:00:02 host cron /home2/user
d2c3be83 2021-09-27 10:00:02 host cron /home2/user
16ee3e87 2021-09-27 12:00:01 host cron /home2/user
59322eff 2021-09-27 14:00:02 host cron /home2/user
152ede11 2021-09-27 18:00:02 host cron /home2/user
-----------------------------------------------------------------------------------------
15 snapshots
What is the reason that it is keeping 16:00 and 20:00 as dailies which are both only 4 hours apart in the same 24 hour time period between 00:00 and 23:59 UTC-4? If I run this at 20:00 my goal is to keep hourlies back to 20:00 on 27-09 and then another daily on 20:00 26-09 which is exactly 2 days prior to the most recent backup.