HUP handling.

This commit is contained in:
Jeremy Fincher 2004-08-23 20:08:49 +00:00
parent c5a4972cc8
commit b085ba5ba3

View File

@ -37,7 +37,9 @@ __revision__ = "$Id$"
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>' __author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
import getopt import getopt
import signal
import supybot.log as log
import supybot.conf as conf import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
import supybot.world as world import supybot.world as world
@ -78,6 +80,17 @@ def getCapability(name):
### Do more later, for specific capabilities/sections. ### Do more later, for specific capabilities/sections.
return capability return capability
def _reload():
ircdb.users.reload()
ircdb.channels.reload()
registry.open(world.registryFilename)
def _hupHandler(sig, frame):
log.info('Received SIGHUP, reloading configuration.')
_reload()
signal.signal(signal.SIGHUP, _hupHandler)
class Config(callbacks.Privmsg): class Config(callbacks.Privmsg):
def callCommand(self, method, irc, msg, *L): def callCommand(self, method, irc, msg, *L):
@ -253,14 +266,11 @@ class Config(callbacks.Privmsg):
Reloads the various configuration files (user database, channel Reloads the various configuration files (user database, channel
database, registry, etc.). database, registry, etc.).
""" """
ircdb.users.reload() _reload() # This was factored out for SIGHUP handling.
ircdb.channels.reload()
registry.open(world.registryFilename)
irc.replySuccess() irc.replySuccess()
reload = privmsgs.checkCapability(reload, 'owner') reload = privmsgs.checkCapability(reload, 'owner')
Class = Config Class = Config
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: