-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Systemd facilities (Socket activation, Notify) -- -- A module for Systemd facilities. @package systemd @version 1.0.2 -- | Implementation of Systemd facilities to create and manage daemons. -- -- This module contains socket activation and notify tools. See -- --
-- import Control.Monad(forever) -- import System.Systemd.Daemon(notifyWatchdog) -- -- main :: IO () -- main = forever $ do -- functionThatMayHang -- notifyWatchdog ---- -- If you use the service described as below, Systemd will restart your -- program each time the watchdog fail to notify itself under 60 sec. -- --
-- [Unit] -- Description=MyDaemon -- -- [Service] -- Type=simple -- TimeoutStartSec=0 -- ExecStart=AbsolutePathToMyExecutable -- WatchdogSec=60 -- Restart=on-failure -- -- [Install] -- WantedBy=multi-user.target --module System.Systemd.Daemon -- | Notify systemd about an event After notifying systemd the Bool -- parameter specify if the environnement shall be unset (Further call to -- notify will fail) The String is the event to pass Returns -- Nothing if the program was not started with systemd or that -- the environnement was previously unset notify :: Bool -> String -> IO (Maybe ()) -- | Notify the watchdog that the program is still alive notifyWatchdog :: IO (Maybe ()) -- | Notify the systemd that the program is ready notifyReady :: IO (Maybe ()) -- | Notify systemd of the PID of the program (for after a fork) notifyPID :: CPid -> IO (Maybe ()) -- | Notify systemd of an Errno error notifyErrno :: Errno -> IO (Maybe ()) -- | Notify systemd of the status of the program. An arbitrary -- String can be passed notifyStatus :: String -> IO (Maybe ()) -- | Notify systemd of a DBUS error like. Correct formatting of the -- String is left to the caller notifyBusError :: String -> IO (Maybe ()) -- | Return a list of activated sockets, if the program was started with -- socket activation. The sockets are in the same order as in the -- associated .socket file. The sockets will have their family, -- type, and status set appropriately. Returns Nothing in -- systems without socket activation (or when the program was not socket -- activated). getActivatedSockets :: IO (Maybe [Socket]) -- | Unset all environnement variable related to Systemd. Calls to -- notify like and getActivatedSockets functions will -- return Nothing after that unsetEnvironnement :: IO ()