summaryrefslogtreecommitdiffstats
path: root/wallace/__init__.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-12 11:56:47 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-12 11:56:47 +0100
commite679b768f55589ab30817a17dcdb7e88be23f85a (patch)
tree40256b5662a6c8d734729a5274963e23909cf855 /wallace/__init__.py
parent63e9da31281eda0d634c2511e404d50e64a908af (diff)
downloadpykolab-e679b768f55589ab30817a17dcdb7e88be23f85a.tar.gz
Prevent failure from writing the pidfile from stopping the process from running (#877)
Diffstat (limited to 'wallace/__init__.py')
-rw-r--r--wallace/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/wallace/__init__.py b/wallace/__init__.py
index f8e204c..0e8a4f7 100644
--- a/wallace/__init__.py
+++ b/wallace/__init__.py
@@ -376,6 +376,9 @@ class WallaceDaemon(object):
def write_pid(self):
pid = os.getpid()
- fp = open(conf.pidfile,'w')
- fp.write("%d\n" % (pid))
- fp.close()
+ if os.access(os.path.dirname(conf.pidfile), os.W_OK):
+ fp = open(conf.pidfile,'w')
+ fp.write("%d\n" % (pid))
+ fp.close()
+ else:
+ print >> sys.stderr, _("Could not write pid file %s") % (conf.pidfile)