Remove daemon for now
This commit is contained in:
+3
-1
@@ -20,7 +20,9 @@ log = CPLog(__name__)
|
||||
|
||||
# Get options via arg
|
||||
from couchpotato.runner import getOptions
|
||||
from couchpotato.core.helpers.variable import getDataDir
|
||||
options = getOptions(base_path, sys.argv[1:])
|
||||
data_dir = getDataDir()
|
||||
|
||||
def start():
|
||||
try:
|
||||
@@ -34,7 +36,7 @@ def start():
|
||||
new_environ[key] = value.encode('iso-8859-1')
|
||||
|
||||
subprocess.call(args, env = new_environ)
|
||||
return os.path.isfile(os.path.join(base_path, 'restart'))
|
||||
return os.path.isfile(os.path.join(data_dir, 'restart'))
|
||||
except KeyboardInterrupt, e:
|
||||
pass
|
||||
except Exception, e:
|
||||
|
||||
@@ -10,6 +10,7 @@ from flask import request
|
||||
from flask.helpers import url_for
|
||||
import os
|
||||
import time
|
||||
import traceback
|
||||
import webbrowser
|
||||
|
||||
|
||||
@@ -79,7 +80,15 @@ class Core(Plugin):
|
||||
try:
|
||||
request.environ.get('werkzeug.server.shutdown')()
|
||||
except:
|
||||
log.error('Failed shutting down the server')
|
||||
try:
|
||||
ctx = app.test_request_context()
|
||||
ctx.push()
|
||||
request.environ.get('werkzeug.server.shutdown')()
|
||||
ctx.pop()
|
||||
except TypeError:
|
||||
pass
|
||||
except:
|
||||
log.error('Failed shutting down the server: %s' % traceback.format_exc())
|
||||
|
||||
def removeRestartFile(self):
|
||||
try:
|
||||
@@ -88,7 +97,7 @@ class Core(Plugin):
|
||||
pass
|
||||
|
||||
def restartFilePath(self):
|
||||
return os.path.join(Env.get('app_dir'), 'restart')
|
||||
return os.path.join(Env.get('data_dir'), 'restart')
|
||||
|
||||
def launchBrowser(self):
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ var Movie = new Class({
|
||||
(function(){
|
||||
var height = self.getHeight();
|
||||
self.el.setStyle('height', height);
|
||||
}).delay(10)
|
||||
}).delay(100)
|
||||
},
|
||||
|
||||
getTitle: function(){
|
||||
|
||||
@@ -3,7 +3,6 @@ from couchpotato import web
|
||||
from couchpotato.api import api
|
||||
from couchpotato.core.event import fireEventAsync, fireEvent
|
||||
from couchpotato.core.helpers.variable import getDataDir, tryInt
|
||||
from daemon import createDaemon
|
||||
from logging import handlers
|
||||
from werkzeug.contrib.cache import FileSystemCache
|
||||
import logging
|
||||
@@ -25,8 +24,6 @@ def getOptions(base_path, args):
|
||||
dest = 'debug', help = 'Debug mode')
|
||||
parser.add_argument('--console_log', action = 'store_true',
|
||||
dest = 'console_log', help = "Log to console")
|
||||
parser.add_argument('--daemon', action = 'store_true',
|
||||
dest = 'daemonize', help = 'Daemonize the app')
|
||||
parser.add_argument('--quiet', action = 'store_true',
|
||||
dest = 'quiet', help = 'No console logging')
|
||||
parser.add_argument('--binary_port', default = None,
|
||||
@@ -64,10 +61,6 @@ def runCouchPotato(options, base_path, args, handle = None):
|
||||
if not os.path.isdir(log_dir):
|
||||
os.mkdir(log_dir)
|
||||
|
||||
# Daemonize app
|
||||
if options.daemonize:
|
||||
createDaemon()
|
||||
|
||||
|
||||
# Register environment settings
|
||||
Env.set('uses_git', not options.nogit)
|
||||
@@ -186,6 +179,11 @@ def runCouchPotato(options, base_path, args, handle = None):
|
||||
# Go go go!
|
||||
try:
|
||||
app.run(**config)
|
||||
except socket.error:
|
||||
log.error('Something else is running on the same address')
|
||||
time.sleep(3)
|
||||
app.run(**config)
|
||||
log.error('Something else is running on the same address222')
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user