error handling should not rest on fuzzy string matching...
Usage: subclass the Daemon class and override the run() method
"""
Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile,
stdin='/dev/null',
def __init__(self, pidfile,
stdin='/dev/null',
- message = "pidfile %s does not exist. Daemon not running?\n"
+ message = "pidfile %s does not exist. Is the Daemon running?\n"
sys.stderr.write(message % self.pidfile)
return # not an error in a restart
sys.stderr.write(message % self.pidfile)
return # not an error in a restart
os.kill(pid, SIGTERM)
time.sleep(0.1)
except OSError, err:
os.kill(pid, SIGTERM)
time.sleep(0.1)
except OSError, err:
- err = str(err)
- if err.find("No such process") > 0:
if os.path.exists(self.pidfile):
if os.path.exists(self.pidfile):
- message = "Daemon not running? removing pid file %s.\n"
+ message = "Daemon's not running? removing pid file %s.\n"
sys.stderr.write(message % self.pidfile)
os.remove(self.pidfile)
else:
sys.stderr.write(message % self.pidfile)
os.remove(self.pidfile)
else: