1. Sam Hart
  2. DaemonicPossession


                         Daemonic Possession
                        Sam Hart, 2010, 2011
1) Introduction
    1.a) Common themes
    1.b) The general logging class
2) The Daemon Patterns
    2.a) A simple loop daemon

1) Introduction

    This project includes several stubbed out samples of basic Linux daemon
patterns. They are intended to be instructional/educational, and are released
under a permissive license in the hopes that others might find them useful.

    While I might be fairly specific in my examples and utilize code which is
designed to run under Linux, chances are the daemon code found herein will run
on under Unix variants as well (usually with little, if any, modification).

    The code found here is the result of work spanning several projects, jobs
and needs. Some of it may date back to early 2003. The purpose of this specific
source repository is to finally, after so many years of scattering this code
all over the place, collect it all in one place so it can serve a useful

1.a) Common themes

    There are a number of common themes used through-out these daemon patterns.
I do not claim original ownership nor copyright on them as most are older than
Linux itself. A simple web search is likely to reveal multiple examples of
these themes engineered in numerous ways.

1.b) The general logging class

    Included in these examples is a generalized logging class. You are free to
use it or discard it as you see fit.

    The purpose of this generalized logging class is to provide something
flexible which can do the following:

            1: Tie into standard syslog services
            2: Log to a custom log file specific to the daemon
            3: During special debug modes, log to named pipes (such as STDOUT)

2) The Daemon Patterns

2.a) A simple loop daemon

    One of the most widely used daemon patterns in use is the "simple loop
daemon". It can be found in "simple_loop/".