packages feed

hdaemonize 0.5.3 → 0.5.4

raw patch · 2 files changed

+11/−41 lines, 2 filesdep ~hsyslogPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hsyslog

API changes (from Hackage documentation)

+ System.Posix.Daemonize: syslog :: Priority -> ByteString -> IO ()

Files

System/Posix/Daemonize.hs view
@@ -6,41 +6,9 @@   -- * Building system services   serviced, CreateDaemon(..), simpleDaemon,   -- * Intradaemon utilities-  fatalError, exitCleanly-  -- * An example-  ---  -- | Here is an example of a full program which writes a message to-  -- syslog once a second proclaiming its continued existance, and-  -- which installs its own SIGHUP handler.  Note that you won't-  -- actually see the message once a second in the log on most-  -- systems.  @syslogd@ detects repeated messages and prints the-  -- first one, then delays for the rest and eventually writes a line-  -- about how many times it has seen it.-  ---  -- > {-# LANGUAGE OverloadedStrings #-}-  -- > module Main where-  -- >-  -- > import System.Posix.Daemonize (CreateDaemon(..), serviced, simpleDaemon)-  -- > import System.Posix.Signals (installHandler, Handler(Catch), sigHUP, fullSignalSet)-  -- > import System.Posix.Syslog (syslogUnsafe, Facility(DAEMON), Priority(Notice))-  -- > import Control.Concurrent (threadDelay)-  -- > import Control.Monad (forever)-  -- >-  -- > main :: IO ()-  -- > main = serviced stillAlive-  -- >-  -- > stillAlive :: CreateDaemon ()-  -- > stillAlive = simpleDaemon { program = stillAliveMain }-  -- >-  -- > stillAliveMain :: () -> IO ()-  -- > stillAliveMain _ = do-  -- >   installHandler sigHUP (Catch taunt) (Just fullSignalSet)-  -- >   forever $ do threadDelay (10^6)-  -- >                syslog DAEMON Notice "I'm still alive!"-  -- >-  -- > taunt :: IO ()-  -- > taunt = syslogUnsafe DAEMON Notice "I sneeze in your general direction, you and your SIGHUP."-+  fatalError, exitCleanly,+  -- * Logging utilities+  syslog   ) where  {- originally based on code from@@ -64,15 +32,17 @@  import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as ByteString+import Data.ByteString.Unsafe (unsafeUseAsCStringLen) import Data.Maybe (isNothing, fromMaybe, fromJust) import System.Environment import System.Exit import System.Posix-import System.Posix.Syslog (withSyslog,SyslogConfig(..),Option(..),Priority(..),PriorityMask(..),Facility(..),syslogUnsafe)+import System.Posix.Syslog (Priority(..), Facility(Daemon), Option, withSyslog)+import qualified System.Posix.Syslog as Log import System.FilePath.Posix (joinPath)  syslog :: Priority -> ByteString -> IO ()-syslog = syslogUnsafe DAEMON+syslog pri msg = unsafeUseAsCStringLen msg (Log.syslog (Just Daemon) pri)  -- | Turning a process into a daemon involves a fixed set of -- operations on unix systems, described in section 13.3 of Stevens@@ -153,7 +123,7 @@         args <- getArgs         process daemon' args     where-      program' daemon = withSyslog (SyslogConfig (ByteString.pack $ fromJust $ name daemon) (syslogOptions daemon) DAEMON NoMask) $ \_ ->+      program' daemon = withSyslog (fromJust (name daemon)) (syslogOptions daemon) Daemon $                       do let log = syslog Notice                          log "starting"                          pidWrite daemon
hdaemonize.cabal view
@@ -1,5 +1,5 @@ Name:		hdaemonize-Version:	0.5.3+Version:	0.5.4 Cabal-Version:  >= 1.6 License:	BSD3 License-file:   LICENSE@@ -15,13 +15,13 @@ 		command line handling, dropping privileges). Build-Type:	Simple Extra-Source-Files:	README.md-Tested-With: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1+Tested-With: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1, GHC == 8.0.2  Library   Build-Depends:    base >= 4 && < 5                   , bytestring                   , unix-                  , hsyslog == 4+                  , hsyslog == 5.*                   , extensible-exceptions                   , filepath                   , mtl