Boilerplate code to start linux daemon. Other platforms will fallback to terminal mode.
Forks daemon process with progMain main function and passes args to it. If daemon catches SIGHUP signal, listener delegate is called. If daemon catches SIGQUIT, SIGABRT, or any other terminating sygnal, the termListener is called.
If application receives "real-time" signal SIGROTATE defined as SIGRTMIN+10, then rotateListener is called
to handle 'logrotate' utility.
Daemon writes log message into provided logger and will close it while exiting.
File pidfile is used to write down PID of detached daemon. This file is usefull for interfacing with external
tools thus it is only way to know daemon PID (for this moment). This file is removed while exiting.
File lockfile is used to track multiple daemon instances. If this file is exists, the another daemon is running
and pgator should exit immediately.
groupid and userid are used to low privileges with run as root.