.. 
    Copyright © 2007, Matthias Urlichs <matthias@urlichs.de>
    .
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    .
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License (included; see the file LICENSE)
    for more details.

===================
The HomEvenT daemon
===================

The daemon (daemon.py) is the "normal" way to run the HomEvenT main loop.

-------------------
Starting the daemon
-------------------

The arguments to the daemon are a number of configuration files. Parsing
the files will stop if one of them does not exist. If that's not what
you want, install a master config file which does:

	if not exists module path:
		load path
	if not exists module file:
		load file

	if exists file "foo.cfg":
		include "foo.cfg"
	if exists file "bar.cfg":
		include "bar.cfg"

The daemon by default logs system panic messages only. Use the "--trace"
option to change that, as in

	daemon.py --trace DEBUG main.cfg

Logging is to stdout. If you want syslog, pipe its output through
"logger" (Debian provides that in the "bsdutils" package).

Remember that HomEvenT needs the Python default encoding set to UTF-8,
and thus requires an appropriate sitecustomize.py somewhere in the
PYTHONPATH when it starts up. (There's no way to change that from within
the HomEvenT code.)

Logging
-------

Probably the easiest way to log what HomEvenT is doing is to go
through syslog. Decide on a 

Since some otuput goes to standard error, the "logger" program is your
friend. Useful arguments include "-t homevent" and "-p local4.info"
or whatever you decide.

On Debian
---------

Start HomEvenT with the included /etc/init.d script.

Note that the supplied default daemon.he script will complain and
immediately die, at least until you replace it with your own code.

-------
Signals
-------

SIGQUIT will stop the daemon when it's idle (i.e. no events are
currently being processed).

SIGINT (a.k.a. pressing ^C) will stop it immediately (more or less).

SIGHUP will cause the configuration files to be reloaded. Unless you
write them correctly, that will cause numerous errors.


-------------------
Configuration files
-------------------

You need to make sure that the config files you use can be loaded more
than once. Specifically, that means not loading a module which is
already loaded, deleting event handlers if they're already defined,
keeping the "drop on …" in the file if you want to remove a handler
(or remove it manually, if you enable SSH access)

Specifically, replace

	load foo

with

	if not exists module foo:
		load foo

and

	on foo bar:
		…

with

	if exists on foo bar:
		del on doo bar
	on foo bar:
		…


