diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2011-04-23 18:50:43 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2011-04-23 18:50:43 -0400 |
| commit | b0a365ec96927f6076e08004ec2a73f1eb83370d (patch) | |
| tree | 12e409cfb244b06953faafbbf2d342421bb3722a | |
| parent | e7531d86ce53d86b1a0b2df9c25c25f98b95c715 (diff) | |
| download | alias-b0a365ec96927f6076e08004ec2a73f1eb83370d.tar.gz | |
Fixed the background options.
basic functionality should work now. Need to figure out
how to redirect the logs to a file
| -rw-r--r-- | server/config.py | 2 | ||||
| -rwxr-xr-x | server/server.py | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/server/config.py b/server/config.py index f693468..755477b 100644 --- a/server/config.py +++ b/server/config.py @@ -11,6 +11,6 @@ class AliasConfigParser(ConfigParser.RawConfigParser): self.host = self.get("component", "host") self.secret = self.get("component", "secret") self.port = self.getint("component", "port") - self.background = self.get("component", "background") + self.background = self.getboolean("component", "background") config = AliasConfigParser() diff --git a/server/server.py b/server/server.py index 3c80da8..7b39330 100755 --- a/server/server.py +++ b/server/server.py @@ -8,7 +8,7 @@ from sleekxmpp.xmlstream.xmlstream import XMLStream from user import UserHandler from config import filename, config import daemon - +from lockfile.pidlockfile import PIDLockFile class ObjectComponent(ComponentXMPP): @@ -91,8 +91,10 @@ if __name__ == '__main__': filename = args.config logging.basicConfig(level = args.debug) config.read(filename) - -with daemon.DaemonContext(detach_process=True,pid="alias_server.pid"): + +with daemon.DaemonContext(detach_process = config.background, + pidfile = PIDLockFile('alias.pid'), + working_directory = '.'): component = ObjectComponent(config.name, config.secret, config.host, config.port, config.root) |
