Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Last active July 27, 2017 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6ec8962ef6d2720b2f2a50631a132cc7 to your computer and use it in GitHub Desktop.
Save anonymous/6ec8962ef6d2720b2f2a50631a132cc7 to your computer and use it in GitHub Desktop.
stdin
(define (rsync-shepherd-service config)
"Return a <shepherd-service> for rsync with CONFIG."
(define pid-file
(rsync-configuration-pid-file config))
(define rsync-command
#~(list (string-append #$(rsync-configuration-package config) "/bin/rsync")
"--daemon" "--config" #$(rsync-config-file config)))
(define port-number
(rsync-configuration-port-number config))
(define user
(if (> port-number 1024)
"rsyncd"
"root"))
(list (shepherd-service
(provision '(rsync))
(documentation "Run rsync daemon.")
(start #~(make-forkexec-constructor #$rsync-command
#:pid-file #$pid-file
#:user #$user
#:group #$user))
(stop #~(make-kill-destructor)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment