aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-07-12 16:26:48 +0100
committerChristopher Baines <mail@cbaines.net>2023-07-12 16:33:56 +0100
commit3ce4613908bb4a42494323ef0597f6c3ae2dee24 (patch)
tree50183818a85496e54c0d7b976ed3c1178e1c1915
parent8d689eb9c7c087726f46e5c906edf5e9de84e41f (diff)
downloadbffe-3ce4613908bb4a42494323ef0597f6c3ae2dee24.tar
bffe-3ce4613908bb4a42494323ef0597f6c3ae2dee24.tar.gz
Support creating a PID file
-rw-r--r--bffe.scm2
-rw-r--r--bffe/server.scm6
2 files changed, 8 insertions, 0 deletions
diff --git a/bffe.scm b/bffe.scm
index 1a137e4..e190ead 100644
--- a/bffe.scm
+++ b/bffe.scm
@@ -33,6 +33,7 @@
#:namespace
"bffe"))
(build '())
+ pid-file
web-server-args)
(let ((lgr (make <logger>))
(port-log (make <port-log>
@@ -55,4 +56,5 @@
(apply start-bffe-web-server
`(,@web-server-args
+ #:pid-file ,pid-file
#:metrics-registry ,metrics-registry))))
diff --git a/bffe/server.scm b/bffe/server.scm
index 40b3193..e929df9 100644
--- a/bffe/server.scm
+++ b/bffe/server.scm
@@ -538,6 +538,7 @@
(assets-directory (%config 'assets-dir))
(event-source "http://localhost:8746")
(controller-args '())
+ pid-file
metrics-registry)
(define state-channel
@@ -579,6 +580,11 @@
(while (< (get-state-id) initial-state-id)
(sleep 1))
+ (when pid-file
+ (call-with-output-file pid-file
+ (lambda (port)
+ (simple-format port "~A\n" (getpid)))))
+
(simple-format #t "Starting the server\n")
(run-server/patched (lambda (request body)
(apply values