Revision 36691f08

b/htools/Ganeti/Daemon.hs
59 59
import System.Posix.IO
60 60
import System.Posix.Process
61 61
import System.Posix.Types
62
import System.Posix.Signals
62 63
import Text.Printf
63 64

  
64 65
import Ganeti.Logging
......
228 229
  _ <- createSession
229 230
  return ()
230 231

  
232
-- | Signal handler for reopening log files.
233
handleSigHup :: FilePath -> IO ()
234
handleSigHup path = do
235
  setupDaemonFDs (Just path)
236
  logInfo "Reopening log files after receiving SIGHUP"
237

  
231 238
-- | Sets up a daemon's standard file descriptors.
232 239
setupDaemonFDs :: Maybe FilePath -> IO ()
233 240
setupDaemonFDs logfile = do
......
294 301
    -- in the child
295 302
    setupDaemonEnv "/" (unionFileModes groupModes otherModes)
296 303
    setupDaemonFDs $ Just logfile
304
    _ <- installHandler lostConnection (Catch (handleSigHup logfile)) Nothing
297 305
    _ <- forkProcess action
298 306
    exitImmediately ExitSuccess
299 307
  exitImmediately ExitSuccess

Also available in: Unified diff