creativeprojects / resticprofile

Configuration profiles manager and scheduler for restic backup
https://creativeprojects.github.io/resticprofile/
GNU General Public License v3.0
604 stars 29 forks source link

Schedule "From now" negative output #378

Open W1zzardTPU opened 2 weeks ago

W1zzardTPU commented 2 weeks ago

Looks like a rounding error

│ 2024-06-30T17:25:51.406207133Z 2024/06/30 17:25:51 using configuration file: /etc/resticprofile/profiles.yaml                                                                                                                               │
│ 2024-06-30T17:25:51.415401032Z                                                                                                                                                                                                              │
│ 2024-06-30T17:25:51.415412702Z Analyzing backup schedule 1/1                                                                                                                                                                                │
│ 2024-06-30T17:25:51.415416271Z =================================                                                                                                                                                                            │
│ 2024-06-30T17:25:51.415419241Z   Original form: *:00,05,10,15,20,25,30,35,40,45,50,55                                                                                                                                                       │
│ 2024-06-30T17:25:51.415421761Z Normalized form: *-*-* *:00,05,10,15,20,25,30,35,40,45,50,55:00                                                                                                                                              │
│ 2024-06-30T17:25:51.415423711Z     Next elapse: Sun Jun 30 17:25:00 UTC 2024                                                                                                                                                                │
│ 2024-06-30T17:25:51.415425701Z        (in UTC): Sun Jun 30 17:25:00 UTC 2024                                                                                                                                                                │
│ 2024-06-30T17:25:51.415427881Z        From now: -51s left                                                                                                                                                                                   │
│ 2024-06-30T17:25:51.415429911Z                                                                                                                                                                                                              │
│ 2024-06-30T17:25:51.415557488Z 2024/06/30 17:25:51 scheduled job default/backup created                                                                                                                                                     │
│ 2024-06-30T17:25:51.420512803Z time="2024-06-30T17:25:51Z" level=info msg="read crontab: /etc/crontab"                                                                                                                                      │
creativeprojects commented 2 weeks ago

Hey!

Are you using the cron scheduler right? not systemd?

If yes I think the rounding error is likely to be there: https://github.com/creativeprojects/resticprofile/blob/ffffabf99c9f24aae25f6981753d415394eba770/calendar/event.go#L99

Thanks for the report 👍🏻

W1zzardTPU commented 2 weeks ago

Are you using the cron scheduler right? not systemd?

Yessir, " scheduler: crontab:-:/etc/crontab"