From f8498fa43b64764784eecb9523bd4d2e1869b6fd Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 3 Aug 2019 01:58:28 +0800 Subject: [PATCH] up --- plugins/go-fastdfs/index.html | 1 - plugins/go-fastdfs/index.py | 12 +++++++----- plugins/go-fastdfs/init.d/go-fastdfs.tpl | 20 +++++++++++--------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/plugins/go-fastdfs/index.html b/plugins/go-fastdfs/index.html index 2377b94c4..bbeddaa5a 100755 --- a/plugins/go-fastdfs/index.html +++ b/plugins/go-fastdfs/index.html @@ -3,7 +3,6 @@

服务

自启动

-

管理

日志

说明

diff --git a/plugins/go-fastdfs/index.py b/plugins/go-fastdfs/index.py index fd699447e..8815ba53b 100755 --- a/plugins/go-fastdfs/index.py +++ b/plugins/go-fastdfs/index.py @@ -7,6 +7,7 @@ import json import re import sys import subprocess +import threading sys.path.append(os.getcwd() + "/class/core") import public @@ -39,7 +40,7 @@ def getInitDTpl(): def getLog(): - return getServerDir() + "/server/logs/solr.log" + return getServerDir() + "/log/fileserver.log" def getArgs(): @@ -96,9 +97,10 @@ def initDreplace(): def start(): file = initDreplace() - # data = public.execShell(file + ' start') - subprocess.Popen(file + ' start', shell=True) - return 'ok' + data = public.execShell(file + ' start') + if data[1] == '': + return 'ok' + return 'fail' def stop(): @@ -155,7 +157,7 @@ def initdUinstall(): os.remove(initd_bin) return 'ok' -# rsyncdReceive + if __name__ == "__main__": func = sys.argv[1] if func == 'status': diff --git a/plugins/go-fastdfs/init.d/go-fastdfs.tpl b/plugins/go-fastdfs/init.d/go-fastdfs.tpl index 94c5b69c5..e0dbf0040 100644 --- a/plugins/go-fastdfs/init.d/go-fastdfs.tpl +++ b/plugins/go-fastdfs/init.d/go-fastdfs.tpl @@ -1,6 +1,6 @@ #!/bin/bash # chkconfig: 2345 55 25 -# description: MW Cloud Service +# description: go-fastdfs Cloud Service ### BEGIN INIT INFO # Provides: bt @@ -8,8 +8,8 @@ # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: starts mw -# Description: starts the mw +# Short-Description: starts go-fastdfs +# Description: starts the go-fastdfs ### END INIT INFO @@ -18,10 +18,11 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin gf_path={$SERVER_PATH}/go-fastdfs gf_start(){ -isStart=`ps -ef| grep -v bash |grep 'go-fastdfs' | grep -v grep|awk '{print $2}'` +isStart=`ps -ef| grep -v python|grep -v bash |grep go-fastdfs | grep -v grep|awk '{print $2}'` if [ "$isStart" == '' ];then echo -e "Starting go-fastdfs... \c" - cd $gf_path && chmod +x go-fastdfs && ./go-fastdfs 1> /dev/null 2>/dev/null & + cd $gf_path + nohup ./go-fastdfs > /dev/null 2>&1 & echo -e "\033[32mdone\033[0m" else echo -e "Starting go-fastdfs(pid $(echo $isStart)) already running" @@ -31,20 +32,21 @@ fi gf_stop() { - echo -e "Stopping go-fastdfs... \c"; - pids=$(ps aux| grep -v bash | grep 'go-fastdfs'| grep -v grep | awk '{print $2}') + echo -e "Stopping go-fastdfs... \c" + + pids=$(ps -ef| grep -v python |grep -v bash |grep go-fastdfs| grep -v grep | awk '{print $2}') arr=($pids) for p in ${arr[@]} do - kill -9 $p + kill -9 $p done echo -e "\033[32mdone\033[0m" } gf_status() { - isStart=$(ps aux | grep -v bash | grep go-fastdfs | grep -v grep | awk '{print $2}') + isStart=$(ps -ef | grep -v python | grep -v bash | grep go-fastdfs | grep -v grep | awk '{print $2}') if [ "$isStart" != '' ];then echo -e "\033[32mgo-fastdfs (pid $(echo $isStart)) already running\033[0m" else