diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-12-28 11:20:12 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-12-28 11:20:12 -0500 |
commit | 2f9d3293511b7b8cc5a38d75c76bc2288c1fbecc (patch) | |
tree | b4737ba8f5f0b0297bcbc1004c9900e360b1e123 | |
parent | 84dfb504a62218a9e000c751e22728c5c5d64746 (diff) |
takemi: os: Factorize nginx signal code.
-rw-r--r-- | takemi-os.scm | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/takemi-os.scm b/takemi-os.scm index b58417b..a32ae59 100644 --- a/takemi-os.scm +++ b/takemi-os.scm @@ -29,6 +29,12 @@ (shell (file-append (specification->package "shadow") "/sbin/nologin"))))) +(define (nginx-signal name signal) + (program-file + name + #~(let ((pid (call-with-input-file "/var/run/nginx/pid" read))) + (kill pid #$signal)))) + ;; Need to override the default nginx service account configuration so ;; that the nginx user is a member of the git group. (define nginx-service-type* @@ -132,12 +138,7 @@ ;; Send SIGHUP signal to nginx to trigger a ;; configuration reload, thus loading the ;; updated certificates. - (deploy-hook (program-file - "nginx-deploy-hook" - #~(let ((pid (call-with-input-file - "/var/run/nginx/pid" - read))) - (kill pid SIGHUP))))))) + (deploy-hook (nginx-signal "nginx-deploy-hook" SIGHUP))))) (webroot "/var/www/certbot"))) (service nginx-service-type* (nginx-configuration @@ -298,13 +299,7 @@ "sharedscripts" ,@%default-log-rotation-options)) ;; Tell nginx to reopen its log files after rotation. - (post-rotate - (program-file - "nginx-post-rotate-hook" - #~(let ((pid (call-with-input-file - "/var/run/nginx/pid" - read))) - (kill pid SIGUSR1))))) + (post-rotate (nginx-signal "nginx-post-rotate-hook" SIGUSR1))) (log-rotation (frequency 'daily) (files '("/var/log/fcgiwrap.log")) |