Hello,
Caleb Herbert <[email protected]> skribis:
> How do I run rsync at only certain hours? I need to run rsync only
> between the hours of 21:30 and 07:30 every day.
On Guix System, you would defined a Shepherd service as a timer.
Take this example found in guix/maintenance.git:
(shepherd-service
(provision (list name))
(requirement '(user-processes))
(documentation
(string-append "rsync " url " to " target))
(modules '((shepherd service timer)))
(start
#~(make-timer-constructor
(cron-string->calendar-event #$spec)
(command '(#$(file-append rsync "/bin/rsync")
"-vur" #$url #$target)
#:user "static-web-site")
#:wait-for-termination? #t))
(stop #~(make-timer-destructor))
(actions (list shepherd-trigger-action)))
… where ‘spec’ defines when the timer triggers (and thus when rsync is
invoked) using the traditional cron syntax, like:
"00 4 * * *" ;<- every day at 4AM
You can read more about Shepherd timers here:
https://doc.guix.gnu.org/shepherd/latest/en/html_node/Timers.html
There are also examples in the Guix code base.
HTH, but if it doesn’t, do ask!
Thanks,
Ludo’.