all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#58405] [PATCH] services: nginx: Add reload action
@ 2022-10-10  4:39 EuAndreh via Guix-patches via
  2022-10-11 10:51 ` Christopher Baines
  2022-10-13 14:02 ` Ludovic Courtès
  0 siblings, 2 replies; 10+ messages in thread
From: EuAndreh via Guix-patches via @ 2022-10-10  4:39 UTC (permalink / raw)
  To: 58405; +Cc: EuAndreh

In a new "reload" shepherd-action, send a SIGHUP to the NGINX master
process, so that it can re-read the configuration file and start new
worker processes.

* gnu/services/web.scm (nginx-shepherd-service): Add the "reload"
  shepherd-action
---
 gnu/services/web.scm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index e5ab1a1180..227a577de3 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -807,7 +807,6 @@ (define (nginx-shepherd-service config)
                           #~#t
                           #~(read-pid-file #$pid-file))))))))
 
-     ;; TODO: Add 'reload' action.
      (list (shepherd-service
             (provision '(nginx))
             (documentation "Run the nginx daemon.")
@@ -815,7 +814,19 @@ (define (nginx-shepherd-service config)
             (modules `((ice-9 match)
                        ,@%default-modules))
             (start (nginx-action "-p" run-directory))
-            (stop (nginx-action "-s" "stop")))))))
+            (stop (nginx-action "-s" "stop"))
+            (actions
+              (list
+               (shepherd-action
+                 (name 'reload)
+                 (documentation "Reload NGINX configuration file and restart worker processes.")
+                 (procedure
+                   #~(lambda (pid)
+                       (if pid
+                         (begin
+                           (kill pid SIGHUP)
+                           (format #t "Service NGINX (PID ~a) has been reloaded." pid))
+                         (format #t "Service NGINX is not running."))))))))))))
 
 (define nginx-service-type
   (service-type (name 'nginx)
-- 
2.37.3





^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-10-14 10:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10  4:39 [bug#58405] [PATCH] services: nginx: Add reload action EuAndreh via Guix-patches via
2022-10-11 10:51 ` Christopher Baines
2022-10-12  7:00   ` EuAndreh via Guix-patches via
2022-10-13 10:40     ` Christopher Baines
2022-10-13 11:38       ` bug#58405: " Christopher Baines
2022-10-13 16:02       ` [bug#58405] " EuAndreh via Guix-patches via
2022-10-13 16:38         ` EuAndreh via Guix-patches via
2022-10-14 10:43         ` Christopher Baines
2022-10-13 14:02 ` Ludovic Courtès
2022-10-13 16:05   ` EuAndreh via Guix-patches via

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.