Test fix #2 for FreeNAS running as a daemon

This commit is contained in:
echel0n 2014-06-18 12:07:53 -07:00
parent da826d24d4
commit 5b866006b4

View file

@ -139,8 +139,6 @@ def main():
TV for me TV for me
""" """
io_loop = IOLoop.current()
# do some preliminary stuff # do some preliminary stuff
sickbeard.MY_FULLNAME = os.path.normpath(os.path.abspath(__file__)) sickbeard.MY_FULLNAME = os.path.normpath(os.path.abspath(__file__))
sickbeard.MY_NAME = os.path.basename(sickbeard.MY_FULLNAME) sickbeard.MY_NAME = os.path.basename(sickbeard.MY_FULLNAME)
@ -310,12 +308,6 @@ def main():
sickbeard.showList = [] sickbeard.showList = []
if sickbeard.DAEMON:
daemonize()
# Use this PID for everything
sickbeard.PID = os.getpid()
if forcedPort: if forcedPort:
logger.log(u"Forcing web server to port " + str(forcedPort)) logger.log(u"Forcing web server to port " + str(forcedPort))
startPort = forcedPort startPort = forcedPort
@ -359,6 +351,12 @@ def main():
loadShowsFromDB() loadShowsFromDB()
def startup(): def startup():
if sickbeard.DAEMON:
daemonize()
# Use this PID for everything
sickbeard.PID = os.getpid()
# Fire up all our threads # Fire up all our threads
sickbeard.start() sickbeard.start()
@ -370,6 +368,9 @@ def main():
if forceUpdate or sickbeard.UPDATE_SHOWS_ON_START: if forceUpdate or sickbeard.UPDATE_SHOWS_ON_START:
sickbeard.showUpdateScheduler.action.run(force=True) # @UndefinedVariable sickbeard.showUpdateScheduler.action.run(force=True) # @UndefinedVariable
# get ioloop
io_loop = IOLoop.current()
# init startup tasks # init startup tasks
io_loop.add_timeout(datetime.timedelta(seconds=5), startup) io_loop.add_timeout(datetime.timedelta(seconds=5), startup)