From d9a1fc0018ae394579a18cf4b4835b67ea97fcba Mon Sep 17 00:00:00 2001 From: anemofilia Date: Mon, 25 Sep 2023 13:56:31 -0300 Subject: [PATCH] feat: add log-file entry to thinkfan-service-configuration in (radix services linux) --- modules/radix/services/linux.scm | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/modules/radix/services/linux.scm b/modules/radix/services/linux.scm index 805c134..ccd4e68 100644 --- a/modules/radix/services/linux.scm +++ b/modules/radix/services/linux.scm @@ -8,26 +8,36 @@ #:export (thinkfan-configuration make-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-service-type)) (define-record-type* thinkfan-configuration make-thinkfan-configuration thinkfan-configuration? - (requirement thinkfan-configuration-requirement ;list of symbols + (requirement thinkfan-configuration-requirement ; list of symbols (default '(user-processes))) - (pid-file thinkfan-configuration-pid-file ;string + (pid-file thinkfan-configuration-pid-file ; string (default "/var/run/thinkfan.pid")) - (config-file thinkfan-configuration-config-file ;#f | file-like - (default (local-file "/etc/thinkfan.conf"))) - (respawn? thinkfan-configuration-respawn? ;boolean + (config-file thinkfan-configuration-config-file ; string + (default "/etc/thinkfan.conf")) + (log-file thinkfan-configuration-log-file ; string + (default "/var/log/thinkfan.log")) + (respawn? thinkfan-configuration-respawn? ; boolean (default #t)) - (extra-options thinkfan-configuration-extra-options ;list of strings + (extra-options thinkfan-configuration-extra-options ; list of strings (default '()))) (define (thinkfan-shepherd-service config) (match-record config - (requirement pid-file config-file respawn? extra-options) + (requirement pid-file config-file log-file respawn? extra-options) (list (shepherd-service (provision '(thinkfan)) (documentation @@ -35,12 +45,10 @@ (requirement requirement) (start #~(make-forkexec-constructor (list (string-append #$thinkfan-next "/sbin/thinkfan") - #$@(if config-file - #~((string-append "-c" #$config-file)) - #~()) + (string-append "-c" #$config-file) #$@extra-options) #:pid-file #$pid-file - #:log-file "/var/log/thinkfan.log")) + #:log-file #$log-file)) (stop #~(make-kill-destructor)) (one-shot? #t) (respawn? respawn?)))))