create pidfile for observer
diff --git a/xos/xos-observer.py b/xos/xos-observer.py
index 83a392a..b85b29b 100644
--- a/xos/xos-observer.py
+++ b/xos/xos-observer.py
@@ -29,6 +29,15 @@
os.dup2(crashlog, 1)
os.dup2(crashlog, 2)
+ if hasattr(config, "observer_pidfile"):
+ pidfile = config.get("observer_pidfile")
+ else:
+ pidfile = "/var/run/xosobserver.pid"
+ try:
+ file(pidfile,"w").write(str(os.getpid()))
+ except:
+ print "failed to create pidfile %s" % pidfile
+
def main():
# Generate command line parser
parser = argparse.ArgumentParser(usage='%(prog)s [options]')