Created
February 14, 2018 05:41
-
-
Save zarkone/fbe223675113d7e545c3d1483b4a66ff to your computer and use it in GitHub Desktop.
Intercept POSIX signals (like, from kill -SIGHUP) in Clojure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns signals-handler | |
(:import [sun.misc Signal SignalHandler])) | |
(defn handle-signals | |
"Sets up POSIX signal handlers." | |
[] | |
(Signal/handle | |
(Signal. "HUP") | |
(proxy [SignalHandler] [] | |
(handle [sig] | |
(println "Caught SIGHUP, reloading") | |
;; reload-config or whatever you want | |
(reload-config!))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment