Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Writing a Perl Daemon

by jdhedden (Deacon)
on Jul 28, 2005 at 13:58 UTC ( #478977=note: print w/replies, xml ) Need Help??

in reply to Writing a Perl Daemon

cees' example above is extremely comprehensive, but here's something to show just the bare bones of what's needed.
#!/usr/bin/perl use strict; use warnings; use Proc::Daemon; use Proc::PID::File; MAIN: { # Daemonize Proc::Daemon::Init(); # If already running, then exit if (Proc::PID::File->running()) { exit(0); } # Perform initializes here # Enter loop to do work for (;;) { # Do whatcha gotta do } }

Remember: There's always one more bug.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://478977]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2016-10-22 00:43 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.