buildDaemon

The template holds a set of functions that build, run and send signals to daemons that are built with Daemon or DaemonClient template. * Truncated DaemonClient aren't able to run described daemon, only signal sending and daemon uninstalling.

Members

Classes

LoggedException
class LoggedException

Saves info about exception into daemon logger

Functions

run
int run(shared IDaemonLogger logger, string pidFilePath = "", string lockFilePath = "", int userId = -1, int groupId = -1)

Starts daemon that is described by DaemonInfo. Daemon is implemented as windows service and auto-installed in SC manager. If you want to uninstall the service, you can use uninstall function or system call:

sendSignal
void sendSignal(shared IDaemonLogger logger, Signal sig, string pidFilePath = "")

Sends singal sig for described daemon. All signals are sent via ControlService WINAPI function.

sendSignalDynamic
void sendSignalDynamic(shared IDaemonLogger logger, string serviceName, Signal sig, string pidFilePath = "")

ditto with dynamic service name

serviceInit
ServiceInitState serviceInit()

If inner StartServiceCtrlDispatcherW fails due reason that the code is running in userspace, the function returns ServiceInitState.NotService.

uninstall
void uninstall(shared IDaemonLogger logger)

Utility function that helps to uninstall the service from the system.

Meta