pull/109/head
Mr Chen 7 years ago
parent 7a7b8b4d3b
commit c0eb2f2670
  1. 1
      .gitignore
  2. 2
      class/core/config.py
  3. 22
      scripts/init.d/mw.tpl
  4. 14
      setting.py

1
.gitignore vendored

@ -113,3 +113,4 @@ data/json/index.json
data/*.db data/*.db
data/control.conf data/control.conf
scripts/init.d/mw scripts/init.d/mw
logs/*

@ -51,6 +51,8 @@ class config:
def initInitD(self): def initInitD(self):
script = public.getRunDir() + '/scripts/init.d/mw.tpl' script = public.getRunDir() + '/scripts/init.d/mw.tpl'
script_bin = public.getRunDir() + '/scripts/init.d/mw' script_bin = public.getRunDir() + '/scripts/init.d/mw'
if os.path.exists(script_bin):
return
content = public.readFile(script) content = public.readFile(script)
content = content.replace("{$SERVER_PATH}", public.getRunDir()) content = content.replace("{$SERVER_PATH}", public.getRunDir())

@ -14,7 +14,7 @@ mw_start(){
if [ "$isStart" == '' ];then if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m" echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------' echo '------------------------------------------------------'
tail -n 20 $panel_path/logs/error.log tail -n 20 $mw_path/logs/error.log
echo '------------------------------------------------------' echo '------------------------------------------------------'
echo -e "\033[31mError: mw service startup failed.\033[0m" echo -e "\033[31mError: mw service startup failed.\033[0m"
return; return;
@ -23,6 +23,26 @@ mw_start(){
else else
echo "Starting mw... mw(pid $(echo $isStart)) already running" echo "Starting mw... mw(pid $(echo $isStart)) already running"
fi fi
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "Starting mw-tasks... \c"
nohup python task.py >> $mw_path/logs/task.log 2>&1 &
sleep 0.2
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $mw_path/logs/task.log
echo '------------------------------------------------------'
echo -e "\033[31mError: mw-tasks service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting mw-tasks... Bt-Tasks (pid $isStart) already running"
fi
} }

@ -4,6 +4,8 @@ import sys
sys.path.append(os.getcwd() + '/class/core') sys.path.append(os.getcwd() + '/class/core')
import public import public
if not os.path.exists(os.getcwd() + '/logs'):
os.mkdir(os.getcwd() + '/logs')
bt_port = public.readFile('data/port.pl') bt_port = public.readFile('data/port.pl')
bind = ['0.0.0.0:%s' % bt_port] bind = ['0.0.0.0:%s' % bt_port]
@ -16,12 +18,12 @@ timeout = 7200
keepalive = 1 keepalive = 1
# worker_class = 'geventwebsocket.gunicorn.workers.GeventWebSocketWorker' # worker_class = 'geventwebsocket.gunicorn.workers.GeventWebSocketWorker'
chdir = os.getcwd() chdir = os.getcwd()
# capture_output = True capture_output = True
# access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"' access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
# loglevel = 'info' loglevel = 'info'
# errorlog = chdir + '/logs/error.log' errorlog = os.getcwd() + '/logs/error.log'
# accesslog = chdir + '/logs/access.log' accesslog = os.getcwd() + '/logs/access.log'
# pidfile = chdir + '/logs/panel.pid' pidfile = os.getcwd() + '/logs/mw.pid'
# if os.path.exists(chdir + '/data/ssl.pl'): # if os.path.exists(chdir + '/data/ssl.pl'):
# certfile = 'ssl/certificate.pem' # certfile = 'ssl/certificate.pem'
# keyfile = 'ssl/privateKey.pem' # keyfile = 'ssl/privateKey.pem'

Loading…
Cancel
Save