daemonize.linux

Daemon implementation for GNU/Linux platform. * The main symbols you might be interested in: * sendSignalDynamic and endSignal - is easy way to send signals to created daemons * runDaemon - forks daemon process and places hooks that are described by Daemon template *

Members

Functions

defaultLockFile
string defaultLockFile(string daemonName)

Returns local lock file that is used when no custom one is specified

defaultPidFile
string defaultPidFile(string daemonName)

Returns local pid file that is used when no custom one is specified

isCustomSignal
bool isCustomSignal(Signal sig)

Checks is sig is not actually built-in

isNativeSignal
bool isNativeSignal(Signal sig)

Checks is sig is actually built-in

Templates

buildDaemon
template buildDaemon(alias DaemonInfo)

Main template in the module that actually creates daemon process. DaemonInfo is a Daemon instance that holds name of the daemon and hooks for numerous Signals. * Daemon is detached from terminal, therefore it needs a preinitialized logger. * As soon as daemon is ready the function executes main delegate that returns application return code. * Daemon uses pid and lock files. Pid file holds process id for communications with other applications. If pidFilePath isn't set, the default path to pid file is '~/.daemonize/<daemonName>.pid'. Lock file prevents from execution of numerous copies of daemons. If lockFilePath isn't set, the default path to lock file is '~/.daemonize/<daemonName>.lock'. If you want several instances of one daemon, redefine pid and lock files paths. * Sometimes lock and pid files are located at /var/run directory and needs a root access. If userId and groupId parameters are set, daemon tries to create lock and pid files and drops root privileges. *

readDaemonInfo
template readDaemonInfo(alias DaemonInfo)

Handles utilities for signal mapping from local representation to GNU/Linux one

Meta

Authors

NCrashed <ncrashed@gmail.com>

License

Subject to the terms of the MIT license, as written in the included LICENSE file.