xtpu2 has asked for the wisdom of the Perl Monks concerning the following question:

This is possibly (probably) a stupid question.

Does use Proc::Daemon; Proc::Daemon::Init; do essentially the same thing as the shell command daemon -- perl somescript.pl? What is the difference?

Edited to Add: I need to run a script as a daemon, and I'm trying to figure out whether it's better practice to have the script handle things such as forking, changing user, setting up the PID file, etc., or to have the script just do the things it's supposed to do, and use existing system tools to do the other stuff (by setting up an init.d script). If that makes sense.

Replies are listed 'Best First'.
Re: Proc::Daemon vs daemon shell command
by morgon (Priest) on May 21, 2014 at 16:04 UTC
    Daemonizing a process is a fairly generic thing to do so I would assume that both Proc::Daemon or daemon would essentially do the same thing.

    However daemon is not a shell built-in but a utility that has to be installed, so it may come down to the question how you want to deploy your application.

    Daemon::Control might also be an alternative as it can also generate init.d-scripts.