Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: perl daemon

by dws (Chancellor)
on Apr 05, 2003 at 00:40 UTC ( [id://248228]=note: print w/replies, xml ) Need Help??


in reply to perl daemon

Details for writing daemons differ between Unices (including Linux) and WinNT/Win2000/WinXP.

Lincoln Stein covers the basics for Unix in Chapter 10, Forking Servers and the inetd Daemon, and Chapter 14, Bulletproofing Servers, in Network Programming with Perl.

There's a bit more to being a well-behaved daemon than is obvious at first glance. On page 312, Stein notes that a well-behaved daemon should:

  1. "Autobackground" itself (fork/parent-exit), then close file handles and lose any assocition with a controlling terminal.
  2. Change the current working directory to a known directory.
  3. Change the file creation mask to a known state.
  4. Set the PATH to a known state.
  5. Record its process ID in a known place
  6. Optionally use syslog to write diagnostics
  7. Optionally handle HUP signals (e.g. to reload configuration files)
  8. Options use chroot()
He then spends the better part of a chapter fleshing that out and giving examples.

Replies are listed 'Best First'.
Re: Re: perl daemon
by DrManhattan (Chaplain) on Apr 05, 2003 at 04:57 UTC
    I've been quite impressed with Net::Daemon so far. It does most of what you listed there right out of the box and appears to be quite portable (though admittedly I have not tried to run it under windows).

    -Matt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-19 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found