diff options
author | EuAndreh <eu@euandre.org> | 2022-10-10 01:39:32 -0300 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-10-13 12:27:35 +0100 |
commit | a9268695e07a1d95a43ea0ea110aafce6cdb5e1a (patch) | |
tree | f560cca5cc192fb6acf09a0c393346cc1d13b61c /gnu/services/web.scm | |
parent | d8271d81936bb31790270fa993fb05b7145374e0 (diff) |
services: nginx: Add reload action.
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.
Signed-off-by: Christopher Baines <mail@cbaines.net>
Diffstat (limited to 'gnu/services/web.scm')
-rw-r--r-- | gnu/services/web.scm | 15 |
1 files 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 @@ of index files." #~#t #~(read-pid-file #$pid-file)))))))) - ;; TODO: Add 'reload' action. (list (shepherd-service (provision '(nginx)) (documentation "Run the nginx daemon.") @@ -815,7 +814,19 @@ of index files." (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) |