Gnuru.org
Productive Linux


Subscribe

 Subscribe via Feedburner in a reader

Enter your email address:

Delivered by FeedBurner


Login
Login:
Password:



Don't have an account?
Sign up to Gnuru.org
Forgot your password?

Creating a daemon
1 April 2004 @ 00:28 BST
by Paul

Sometimes you might want to create a back-ground process or a daemon to carry out some task. For example, a process that listens for an event, like a server does.

These daemons must have certain characteristcs:

  • Become a process-group leader (by doing a setsid),
  • be disassociated from the controling terminal (by forking),
  • change working directory (chdir) to the root directory
  • set its umask to 0
  • close any uneeded descriptors or point them to /dev/null

A good example of how it is done in Perl is here




Comments disabled