diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-18 19:58:26 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-18 19:59:21 +0200 |
commit | 78c9575acca2ad461f2b6cbae1bbc92e939ef6d6 (patch) | |
tree | 22d559fc39b9771d9d4bd2a1209544ad1f22c836 /module/c | |
parent | CPP, rename 'atom?' to 'immediate?'. (diff) | |
download | calp-78c9575acca2ad461f2b6cbae1bbc92e939ef6d6.tar.gz calp-78c9575acca2ad461f2b6cbae1bbc92e939ef6d6.tar.xz |
SIGUSR1 to reload calendars.
Diffstat (limited to '')
-rw-r--r-- | module/calp/entry-points/server.scm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/module/calp/entry-points/server.scm b/module/calp/entry-points/server.scm index 443892f3..f8262b76 100644 --- a/module/calp/entry-points/server.scm +++ b/module/calp/entry-points/server.scm @@ -6,7 +6,6 @@ :use-module (srfi srfi-1) :use-module (ice-9 getopt-long) - ;; :use-module (ice-9 regex) #| regex here due to bad macros |# :use-module ((calp server server) :select (start-server)) @@ -23,6 +22,7 @@ ;; numbers as single-char doesn't work. (six (description "Use IPv6.")) (four (description "Use IPv4.")) + (sigusr (description "Reload events on SIGUSR1")) (help (single-char #\h) (description "Print this help.")))) @@ -51,6 +51,15 @@ (if (eqv? family AF_INET6) "::" "0.0.0.0"))) + (when (option-ref opts 'sigusr #f) + (display "Listening for SIGUSR1\n" (current-error-port)) + ;; NOTE this uses the main thread, and does therefore block HTTP requests + ;; while reloading. However, it appears to not cause any race conditions. + (sigaction SIGUSR1 + (lambda _ + (display "Received SIGUSR1, reloading calendars\n" + (current-error-port)) + ((@ (vcomponent instance) reload))))) (format #t "Starting server on ~a:~a~%I'm ~a, runing from ~a~%" addr port |