in reply to A few questions regarding Proc::Daemon
Have a look at daemontools. Essentially, daemontools take care of start, stop, restart, logging, sending signals, "becoming a daemon". You don't have to reinvent all of this. Just write the code that "does the job". Send log output to STDOUT or STDERR. Don't fork background processes.
The concept of daemontools is often copied, you can find a very similar implementation in runit standalone and in busybox, systemd also expect daemons to run under its control, so does upstart.
All of these systems need extra work for daemons that fork themselves to the "background". Even a classic init that controls a daemon expect it not to fork to "background". The "going to background" is only really meaningful when starting daemons manually from a (virtual) terminal or the console, and there, a small shell script using kill, fork, exec, nohup and i/o redirection makes much more sense. This script can also be used from classic init scripts.
Alexander
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: A few questions regarding Proc::Daemon
by walkingthecow (Friar) on Nov 08, 2013 at 10:00 UTC | |
by afoken (Chancellor) on Nov 08, 2013 at 10:33 UTC | |
by walkingthecow (Friar) on Nov 08, 2013 at 20:31 UTC | |
by afoken (Chancellor) on Nov 09, 2013 at 22:33 UTC |