resticprofile icon indicating copy to clipboard operation
resticprofile copied to clipboard

crond: add support for crontab file only (on any OS)

Open jkellerer opened this issue 2 years ago • 1 comments

Implements #288

The PR allows to use an external scheduler that supports crontab format when configured as:

global:
  scheduler: "crontab: /path/to/crontab/file"

(this is available on any OS)

The existing crond support using the crontab binary remains unchanged for linux

waiting on #259 before implementing remaining tests

jkellerer avatar Nov 11 '23 22:11 jkellerer

This would also help with #321 as I realised that the crond implementation in busybox (alpine linux) has funny rules when trying to run as a non-root user. It doesn't work with the current implementation of using crontab to set or update the scheduling.

creativeprojects avatar Feb 23 '24 12:02 creativeprojects

Codecov Report

Attention: Patch coverage is 78.00000% with 66 lines in your changes are missing coverage. Please review.

Project coverage is 71.51%. Comparing base (85d5afc) to head (957db95).

Files Patch % Lines
crond/mock/main.go 0.00% 34 Missing :warning:
schedule/handler_crond.go 48.00% 11 Missing and 2 partials :warning:
crond/io.go 87.32% 5 Missing and 4 partials :warning:
crond/crontab.go 91.78% 3 Missing and 3 partials :warning:
schedule/handler.go 86.67% 2 Missing :warning:
schedule/scheduler_config.go 95.56% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #289      +/-   ##
==========================================
+ Coverage   71.07%   71.51%   +0.44%     
==========================================
  Files         121      121              
  Lines       12394    12659     +265     
==========================================
+ Hits         8809     9053     +244     
- Misses       3189     3201      +12     
- Partials      396      405       +9     
Flag Coverage Δ
unittests 71.51% <78.00%> (+0.44%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 21 '24 18:03 codecov[bot]

Had tested all options manually, think it is ready now.

jkellerer avatar Mar 21 '24 19:03 jkellerer

Yes. Supersonic is one option to have a compatible task scheduler that is OS independent (besides that it needs to run as service)

jkellerer avatar Mar 22 '24 21:03 jkellerer

The use case with alpine should work as well. Had used busybox’s cron with custom crontab files previously.

jkellerer avatar Mar 22 '24 21:03 jkellerer

The use case with alpine should work as well. Had used busybox’s cron with custom crontab files previously.

Yes it works when running as root. With this PR I managed to get resticprofile scheduled as a non-privileged user (using Supercronic). I'll add a contrib for it.

I'm also tempted to provide another docker image with running resticprofile as a non-privileged user.

creativeprojects avatar Mar 22 '24 21:03 creativeprojects