+ -- First we install a signal handler for sigTERM. We need to
+ -- pass the thread ID to the signal handler so it knows which
+ -- process to "exit."
+ tid <- myThreadId
+ _ <- installHandler sigTERM (Catch (graceful_shutdown cfg tid)) Nothing
+
+ -- Next we drop privileges. Group ID has to go first, otherwise
+ -- you ain't root to change groups.
+ get_group_id (run_as_group cfg) >>= setGroupID
+ get_user_id (run_as_user cfg) >>= setUserID
+
+ -- Now we create the PID file.