pull/109/head
midoks 6 years ago
parent fdd9130984
commit f8498fa43b
  1. 1
      plugins/go-fastdfs/index.html
  2. 12
      plugins/go-fastdfs/index.py
  3. 20
      plugins/go-fastdfs/init.d/go-fastdfs.tpl

@ -3,7 +3,6 @@
<div class="bt-w-menu"> <div class="bt-w-menu">
<p class="bgw" onclick="pluginService('go-fastdfs');">服务</p> <p class="bgw" onclick="pluginService('go-fastdfs');">服务</p>
<p onclick="pluginInitD('go-fastdfs');">自启动</p> <p onclick="pluginInitD('go-fastdfs');">自启动</p>
<p onclick="collectionManagement();">管理</p>
<p onclick="pluginLogs('go-fastdfs','','run_log');">日志</p> <p onclick="pluginLogs('go-fastdfs','','run_log');">日志</p>
<p onclick="pRead()">说明</p> <p onclick="pRead()">说明</p>
</div> </div>

@ -7,6 +7,7 @@ import json
import re import re
import sys import sys
import subprocess import subprocess
import threading
sys.path.append(os.getcwd() + "/class/core") sys.path.append(os.getcwd() + "/class/core")
import public import public
@ -39,7 +40,7 @@ def getInitDTpl():
def getLog(): def getLog():
return getServerDir() + "/server/logs/solr.log" return getServerDir() + "/log/fileserver.log"
def getArgs(): def getArgs():
@ -96,9 +97,10 @@ def initDreplace():
def start(): def start():
file = initDreplace() file = initDreplace()
# data = public.execShell(file + ' start') data = public.execShell(file + ' start')
subprocess.Popen(file + ' start', shell=True) if data[1] == '':
return 'ok' return 'ok'
return 'fail'
def stop(): def stop():
@ -155,7 +157,7 @@ def initdUinstall():
os.remove(initd_bin) os.remove(initd_bin)
return 'ok' return 'ok'
# rsyncdReceive
if __name__ == "__main__": if __name__ == "__main__":
func = sys.argv[1] func = sys.argv[1]
if func == 'status': if func == 'status':

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# chkconfig: 2345 55 25 # chkconfig: 2345 55 25
# description: MW Cloud Service # description: go-fastdfs Cloud Service
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: bt # Provides: bt
@ -8,8 +8,8 @@
# Required-Stop: $all # Required-Stop: $all
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: starts mw # Short-Description: starts go-fastdfs
# Description: starts the mw # Description: starts the go-fastdfs
### END INIT INFO ### 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_path={$SERVER_PATH}/go-fastdfs
gf_start(){ 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 if [ "$isStart" == '' ];then
echo -e "Starting go-fastdfs... \c" 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" echo -e "\033[32mdone\033[0m"
else else
echo -e "Starting go-fastdfs(pid $(echo $isStart)) already running" echo -e "Starting go-fastdfs(pid $(echo $isStart)) already running"
@ -31,20 +32,21 @@ fi
gf_stop() gf_stop()
{ {
echo -e "Stopping go-fastdfs... \c"; echo -e "Stopping go-fastdfs... \c"
pids=$(ps aux| grep -v bash | grep 'go-fastdfs'| grep -v grep | awk '{print $2}')
pids=$(ps -ef| grep -v python |grep -v bash |grep go-fastdfs| grep -v grep | awk '{print $2}')
arr=($pids) arr=($pids)
for p in ${arr[@]} for p in ${arr[@]}
do do
kill -9 $p kill -9 $p
done done
echo -e "\033[32mdone\033[0m" echo -e "\033[32mdone\033[0m"
} }
gf_status() 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 if [ "$isStart" != '' ];then
echo -e "\033[32mgo-fastdfs (pid $(echo $isStart)) already running\033[0m" echo -e "\033[32mgo-fastdfs (pid $(echo $isStart)) already running\033[0m"
else else

Loading…
Cancel
Save