feat: add log-file entry to thinkfan-service-configuration in (radix services linux)

pull/1/head
anemofilia 2023-09-25 13:56:31 -03:00
parent 50a545303f
commit d9a1fc0018
No known key found for this signature in database
GPG Key ID: 5A8F3D62C87A2B33
1 changed files with 19 additions and 11 deletions

View File

@ -8,26 +8,36 @@
#:export (thinkfan-configuration #:export (thinkfan-configuration
make-thinkfan-configuration make-thinkfan-configuration
thinkfan-configuration? thinkfan-configuration?
thinkfan-configuration-requirement
thinkfan-configuration-pid-file
thinkfan-configuration-config-file
thinkfan-configuration-log-file
thinkfan-configuration-respawn
thinkfan-configuration-extra-options
thinkfan-shepherd-service thinkfan-shepherd-service
thinkfan-service-type)) thinkfan-service-type))
(define-record-type* <thinkfan-configuration> (define-record-type* <thinkfan-configuration>
thinkfan-configuration make-thinkfan-configuration thinkfan-configuration make-thinkfan-configuration
thinkfan-configuration? thinkfan-configuration?
(requirement thinkfan-configuration-requirement ;list of symbols (requirement thinkfan-configuration-requirement ; list of symbols
(default '(user-processes))) (default '(user-processes)))
(pid-file thinkfan-configuration-pid-file ;string (pid-file thinkfan-configuration-pid-file ; string
(default "/var/run/thinkfan.pid")) (default "/var/run/thinkfan.pid"))
(config-file thinkfan-configuration-config-file ;#f | file-like (config-file thinkfan-configuration-config-file ; string
(default (local-file "/etc/thinkfan.conf"))) (default "/etc/thinkfan.conf"))
(respawn? thinkfan-configuration-respawn? ;boolean (log-file thinkfan-configuration-log-file ; string
(default "/var/log/thinkfan.log"))
(respawn? thinkfan-configuration-respawn? ; boolean
(default #t)) (default #t))
(extra-options thinkfan-configuration-extra-options ;list of strings (extra-options thinkfan-configuration-extra-options ; list of strings
(default '()))) (default '())))
(define (thinkfan-shepherd-service config) (define (thinkfan-shepherd-service config)
(match-record config <thinkfan-configuration> (match-record config <thinkfan-configuration>
(requirement pid-file config-file respawn? extra-options) (requirement pid-file config-file log-file respawn? extra-options)
(list (shepherd-service (list (shepherd-service
(provision '(thinkfan)) (provision '(thinkfan))
(documentation (documentation
@ -35,12 +45,10 @@
(requirement requirement) (requirement requirement)
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (string-append #$thinkfan-next "/sbin/thinkfan") (list (string-append #$thinkfan-next "/sbin/thinkfan")
#$@(if config-file (string-append "-c" #$config-file)
#~((string-append "-c" #$config-file))
#~())
#$@extra-options) #$@extra-options)
#:pid-file #$pid-file #:pid-file #$pid-file
#:log-file "/var/log/thinkfan.log")) #:log-file #$log-file))
(stop #~(make-kill-destructor)) (stop #~(make-kill-destructor))
(one-shot? #t) (one-shot? #t)
(respawn? respawn?))))) (respawn? respawn?)))))