Add some error checking when starting Linux daemons.
This commit is contained in:
parent
4f2976a9d4
commit
f879487932
|
@ -91,6 +91,12 @@ class Daemon(object):
|
|||
|
||||
# Start the daemon
|
||||
if daemonize:
|
||||
# Make sure the pidfile will be writable.
|
||||
folder = os.path.dirname(self.pidfile)
|
||||
if not os.path.exists(folder):
|
||||
os.makedirs(folder)
|
||||
if not os.access(folder, os.W_OK):
|
||||
raise RuntimeError(u"Cannot write to folder: {0}".format(folder))
|
||||
self.daemonize()
|
||||
self.run()
|
||||
|
||||
|
|
Loading…
Reference in a new issue