mirror of https://github.com/midoks/mdserver-web
pull/109/head
parent
6a6a1d2804
commit
6bfa25fa65
Before Width: | Height: | Size: 4.4 KiB |
@ -1,21 +0,0 @@ |
||||
<div class="bt-form"> |
||||
<div class="bt-w-main"> |
||||
<div class="bt-w-menu"> |
||||
<p class="bgw" onclick="pluginService('go-fastdfs-web');">服务</p> |
||||
<p onclick="pluginInitD('go-fastdfs-web');">自启动</p> |
||||
<p onclick="pluginConfig('go-fastdfs-web');">配置</p> |
||||
<p onclick="pluginLogs('go-fastdfs-web','','run_log');">运行日志</p> |
||||
<p onclick="pRead()">说明</p> |
||||
</div> |
||||
<div class="bt-w-con pd15"> |
||||
<div class="soft-man-con"></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<script type="text/javascript"> |
||||
resetPluginWinWidth(700); |
||||
$.getScript( "/plugins/file?name=go-fastdfs-web&f=js/fastdfs.js", function() { |
||||
pluginService('go-fastdfs'); |
||||
}); |
||||
</script> |
@ -1,196 +0,0 @@ |
||||
# coding: utf-8 |
||||
|
||||
import time |
||||
import random |
||||
import os |
||||
import json |
||||
import re |
||||
import sys |
||||
import subprocess |
||||
import threading |
||||
|
||||
sys.path.append(os.getcwd() + "/class/core") |
||||
import mw |
||||
|
||||
app_debug = False |
||||
if mw.isAppleSystem(): |
||||
app_debug = True |
||||
|
||||
|
||||
def getPluginName(): |
||||
return 'go-fastdfs-web' |
||||
|
||||
|
||||
def getPluginDir(): |
||||
return mw.getPluginDir() + '/' + getPluginName() |
||||
|
||||
|
||||
def getServerDir(): |
||||
return mw.getServerDir() + '/' + getPluginName() |
||||
|
||||
|
||||
def getInitDFile(): |
||||
if app_debug: |
||||
return '/tmp/' + getPluginName() |
||||
return '/etc/init.d/' + getPluginName() |
||||
|
||||
|
||||
def getInitDTpl(): |
||||
return getPluginDir() + "/init.d/" + getPluginName() + ".tpl" |
||||
|
||||
|
||||
def getLog(): |
||||
return getServerDir() + "/log/fileserver.log" |
||||
|
||||
|
||||
def gfBreakpointLog(): |
||||
return getServerDir() + "/log/tusd.log" |
||||
|
||||
|
||||
def getArgs(): |
||||
args = sys.argv[2:] |
||||
tmp = {} |
||||
args_len = len(args) |
||||
|
||||
if args_len == 1: |
||||
t = args[0].strip('{').strip('}') |
||||
t = t.split(':') |
||||
tmp[t[0]] = t[1] |
||||
elif args_len > 1: |
||||
for i in range(len(args)): |
||||
t = args[i].split(':') |
||||
tmp[t[0]] = t[1] |
||||
|
||||
return tmp |
||||
|
||||
|
||||
def checkArgs(data, ck=[]): |
||||
for i in range(len(ck)): |
||||
if not ck[i] in data: |
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!')) |
||||
return (True, mw.returnJson(True, 'ok')) |
||||
|
||||
|
||||
def status(): |
||||
pn = getPluginName() |
||||
data = mw.execShell( |
||||
"ps -ef|grep " + pn + " | grep -v grep | grep -v python | awk '{print $2}'") |
||||
if data[0] == '': |
||||
return 'stop' |
||||
return 'start' |
||||
|
||||
|
||||
def initDreplace(): |
||||
|
||||
file_tpl = getInitDTpl() |
||||
service_path = os.path.dirname(os.getcwd()) |
||||
|
||||
initD_path = getServerDir() + '/init.d' |
||||
if not os.path.exists(initD_path): |
||||
os.mkdir(initD_path) |
||||
|
||||
file_bin = initD_path + '/' + getPluginName() |
||||
if not os.path.exists(file_bin): |
||||
content = mw.readFile(file_tpl) |
||||
content = content.replace('{$SERVER_PATH}', service_path) |
||||
mw.writeFile(file_bin, content) |
||||
mw.execShell('chmod +x ' + file_bin) |
||||
|
||||
return file_bin |
||||
|
||||
|
||||
def start(): |
||||
file = initDreplace() |
||||
data = mw.execShell(file + ' start') |
||||
if data[1] == '': |
||||
return 'ok' |
||||
return 'fail' |
||||
|
||||
|
||||
def stop(): |
||||
file = initDreplace() |
||||
data = mw.execShell(file + ' stop') |
||||
if data[1] == '': |
||||
return 'ok' |
||||
return 'fail' |
||||
|
||||
|
||||
def restart(): |
||||
file = initDreplace() |
||||
data = mw.execShell(file + ' restart') |
||||
if data[1] == '': |
||||
return 'ok' |
||||
return 'fail' |
||||
|
||||
|
||||
def reload(): |
||||
file = initDreplace() |
||||
data = mw.execShell(file + ' reload') |
||||
if data[1] == '': |
||||
return 'ok' |
||||
return 'fail' |
||||
|
||||
|
||||
def initdStatus(): |
||||
initd_bin = getInitDFile() |
||||
if os.path.exists(initd_bin): |
||||
return 'ok' |
||||
return 'fail' |
||||
|
||||
|
||||
def initdInstall(): |
||||
import shutil |
||||
|
||||
source_bin = initDreplace() |
||||
initd_bin = getInitDFile() |
||||
shutil.copyfile(source_bin, initd_bin) |
||||
mw.execShell('chmod +x ' + initd_bin) |
||||
|
||||
if not app_debug: |
||||
mw.execShell('chkconfig --add ' + getPluginName()) |
||||
return 'ok' |
||||
|
||||
|
||||
def initdUinstall(): |
||||
if not app_debug: |
||||
mw.execShell('chkconfig --del ' + getPluginName()) |
||||
|
||||
initd_bin = getInitDFile() |
||||
|
||||
if os.path.exists(initd_bin): |
||||
os.remove(initd_bin) |
||||
return 'ok' |
||||
|
||||
|
||||
def gfConf(): |
||||
return getServerDir() + "/config/application-prod.properties" |
||||
|
||||
|
||||
def getLog(): |
||||
return getServerDir() + "/logs/go-fastdfs-web.log" |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
func = sys.argv[1] |
||||
if func == 'status': |
||||
print(status()) |
||||
elif func == 'start': |
||||
print(start()) |
||||
elif func == 'stop': |
||||
print(stop()) |
||||
elif func == 'restart': |
||||
print(restart()) |
||||
elif func == 'reload': |
||||
print(reload()) |
||||
elif func == 'initd_status': |
||||
print(initdStatus()) |
||||
elif func == 'initd_install': |
||||
print(initdInstall()) |
||||
elif func == 'initd_uninstall': |
||||
print(initdUinstall()) |
||||
elif func == 'run_log': |
||||
print(getLog()) |
||||
elif func == 'conf': |
||||
print(gfConf()) |
||||
else: |
||||
print('error') |
@ -1,16 +0,0 @@ |
||||
{ |
||||
"id":10, |
||||
"title":"go-fastdfs-web", |
||||
"tip":"soft", |
||||
"name":"go-fastdfs-web", |
||||
"type":"软件", |
||||
"ps":"Go-Fastdfs web管理平台", |
||||
"versions":"1.1.2", |
||||
"shell":"install.sh", |
||||
"checks":"server/go-fastdfs-web", |
||||
"path": "server/go-fastdfs-web", |
||||
"author":"midoks", |
||||
"home":"https://github.com/perfree/go-fastdfs-web", |
||||
"date":"2019-08-07", |
||||
"pid":"5" |
||||
} |
@ -1,91 +0,0 @@ |
||||
#!/bin/bash |
||||
# chkconfig: 2345 55 25 |
||||
# description: go-fastdfs-web Cloud Service |
||||
|
||||
### BEGIN INIT INFO |
||||
# Provides: bt |
||||
# Required-Start: $all |
||||
# Required-Stop: $all |
||||
# Default-Start: 2 3 4 5 |
||||
# Default-Stop: 0 1 6 |
||||
# Short-Description: starts go-fastdfs-web |
||||
# Description: starts the go-fastdfs-web |
||||
### END INIT INFO |
||||
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||
|
||||
SpringBoot=go-fastdfs-web.jar |
||||
gf_path={$SERVER_PATH}/go-fastdfs-web/$SpringBoot |
||||
|
||||
if [ "$1" = "" ]; |
||||
then |
||||
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$SpringBoot" = "" ]; |
||||
then |
||||
echo -e "\033[0;31m 未输入应用名 \033[0m" |
||||
exit 1 |
||||
fi |
||||
|
||||
function start() |
||||
{ |
||||
count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` |
||||
if [ $count != 0 ];then |
||||
echo "$SpringBoot is running..." |
||||
else |
||||
echo "Start $SpringBoot success..." |
||||
cd $gf_path |
||||
nohup java -jar $SpringBoot > /dev/null 2>&1 & |
||||
fi |
||||
} |
||||
|
||||
function stop() |
||||
{ |
||||
echo "Stop $SpringBoot" |
||||
boot_id=`ps -ef |grep java|grep $SpringBoot|grep -v grep|awk '{print $2}'` |
||||
count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` |
||||
|
||||
if [ $count != 0 ];then |
||||
kill $boot_id |
||||
count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` |
||||
|
||||
boot_id=`ps -ef |grep java|grep $SpringBoot|grep -v grep|awk '{print $2}'` |
||||
kill -9 $boot_id |
||||
fi |
||||
} |
||||
|
||||
function restart() |
||||
{ |
||||
stop |
||||
sleep 2 |
||||
start |
||||
} |
||||
|
||||
function status() |
||||
{ |
||||
count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` |
||||
if [ $count != 0 ];then |
||||
echo "$SpringBoot is running..." |
||||
else |
||||
echo "$SpringBoot is not running..." |
||||
fi |
||||
} |
||||
|
||||
case $1 in |
||||
start) |
||||
start;; |
||||
stop) |
||||
stop;; |
||||
restart) |
||||
restart;; |
||||
status) |
||||
status;; |
||||
*) |
||||
|
||||
echo -e "\033[0;31m Usage: \033[0m \033[0;34m sh $0 {start|stop|restart|status} {SpringBootJarName} \033[0m |
||||
\033[0;31m Example: \033[0m |
||||
\033[0;33m sh $0 start esmart-test.jar \033[0m" |
||||
esac |
@ -1,54 +0,0 @@ |
||||
#!/bin/bash |
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||
export PATH |
||||
|
||||
curPath=`pwd` |
||||
rootPath=$(dirname "$curPath") |
||||
rootPath=$(dirname "$rootPath") |
||||
serverPath=$(dirname "$rootPath") |
||||
sysName=`uname` |
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl |
||||
|
||||
action=$1 |
||||
version=$2 |
||||
Install_gf() |
||||
{ |
||||
echo '正在安装脚本文件...' > $install_tmp |
||||
mkdir -p $serverPath/go-fastdfs-web |
||||
FF_DIR=${serverPath}/go-fastdfs-web |
||||
cd $FF_DIR |
||||
|
||||
if [ $sysName == 'Darwin' ]; then |
||||
FF_SS_DIR=${serverPath}/source/go-fastdfs-web |
||||
mkdir -p $FF_SS_DIR |
||||
if [ ! -f $FF_SS_DIR/go-fastdfs-web-1.1.2.tar.gz ]; then |
||||
wget -O $FF_SS_DIR/go-fastdfs-web-1.1.2.tar.gz https://github.com/perfree/go-fastdfs-web/releases/download/1.1.2/go-fastdfs-web-1.1.2.tar.gz |
||||
fi |
||||
|
||||
cd $FF_SS_DIR |
||||
if [ ! -d $FF_SS_DIR/go-fastdfs-web ]; then |
||||
tar -zxvf $FF_SS_DIR/go-fastdfs-web-1.1.2.tar.gz |
||||
fi |
||||
|
||||
if [ ! -d $FF_DIR/config ];then |
||||
cp -rf $FF_SS_DIR/go-fastdfs-web/* $FF_DIR/ |
||||
fi |
||||
fi |
||||
|
||||
echo "$version" > $FF_DIR/version.pl |
||||
echo '安装完成' > $install_tmp |
||||
} |
||||
|
||||
Uninstall_gf() |
||||
{ |
||||
rm -rf $serverPath/go-fastdfs-web |
||||
echo "卸载完成" > $install_tmp |
||||
} |
||||
|
||||
|
||||
if [ "${1}" == 'install' ];then |
||||
Install_gf $version |
||||
else |
||||
Uninstall_gf $version |
||||
fi |
@ -1,47 +0,0 @@ |
||||
function str2Obj(str){ |
||||
var data = {}; |
||||
kv = str.split('&'); |
||||
for(i in kv){ |
||||
v = kv[i].split('='); |
||||
data[v[0]] = v[1]; |
||||
} |
||||
return data; |
||||
} |
||||
|
||||
function pPost(method,args,callback, title){ |
||||
|
||||
var _args = null;
|
||||
if (typeof(args) == 'string'){ |
||||
_args = JSON.stringify(str2Obj(args)); |
||||
} else { |
||||
_args = JSON.stringify(args); |
||||
} |
||||
|
||||
var _title = '正在获取...'; |
||||
if (typeof(title) != 'undefined'){ |
||||
_title = title; |
||||
} |
||||
|
||||
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 }); |
||||
$.post('/plugins/run', {name:'go-fastdfs-web', func:method, args:_args}, function(data) { |
||||
layer.close(loadT); |
||||
if (!data.status){ |
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
||||
return; |
||||
} |
||||
|
||||
if(typeof(callback) == 'function'){ |
||||
callback(data); |
||||
} |
||||
},'json');
|
||||
} |
||||
|
||||
|
||||
|
||||
function pRead(){ |
||||
var readme = '<ul class="help-info-text c7">'; |
||||
readme += '<li>根据配置查看,开启相应防火墙端口</li>'; |
||||
readme += '</ul>'; |
||||
|
||||
$('.soft-man-con').html(readme);
|
||||
} |
Loading…
Reference in new issue