mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
+21
-9
@@ -281,21 +281,33 @@ def rsyncOp(method):
|
|||||||
return 'fail'
|
return 'fail'
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def lsyncdOp(method):
|
||||||
return rsyncOp('start')
|
if not mw.isAppleSystem():
|
||||||
|
data = mw.execShell('systemctl ' + method + ' lsyncd')
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return 'fail'
|
||||||
|
return 'fail'
|
||||||
|
|
||||||
|
def start():
|
||||||
|
status = rsyncOp('start')
|
||||||
|
lsyncdOp('start')
|
||||||
|
return status
|
||||||
|
|
||||||
def stop():
|
def stop():
|
||||||
return rsyncOp('stop')
|
status = rsyncOp('stop')
|
||||||
|
lsyncdOp('stop')
|
||||||
|
return status
|
||||||
|
|
||||||
def restart():
|
def restart():
|
||||||
return rsyncOp('restart')
|
status = rsyncOp('restart')
|
||||||
|
lsyncdOp('restart')
|
||||||
|
return status
|
||||||
|
|
||||||
def reload():
|
def reload():
|
||||||
return rsyncOp('reload')
|
status = rsyncOp('reload')
|
||||||
|
lsyncdOp('reload')
|
||||||
|
return status
|
||||||
|
|
||||||
def initdStatus():
|
def initdStatus():
|
||||||
if mw.isAppleSystem():
|
if mw.isAppleSystem():
|
||||||
@@ -722,7 +734,7 @@ def lsyncdAdd():
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
args = getArgs()
|
args = getArgs()
|
||||||
data = checkArgs(args, ['ip', 'conn_type', 'path', 'delay', 'period'])
|
data = checkArgs(args, ['ip', 'conn_type', 'path', 'delay', 'period', 'bwlimit'])
|
||||||
if not data[0]:
|
if not data[0]:
|
||||||
return data[1]
|
return data[1]
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,15 @@ function createSendTask(name = ''){
|
|||||||
period_minute_n = "selected";
|
period_minute_n = "selected";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bwlimit = "1024";
|
||||||
|
if ('rsync' in data){
|
||||||
|
bwlimit = data['rsync']['bwlimit'];
|
||||||
|
}
|
||||||
|
|
||||||
|
var delay = "3";
|
||||||
|
if ('delay' in data){
|
||||||
|
delay = data['delay'];
|
||||||
|
}
|
||||||
|
|
||||||
var layerID = layer.open({
|
var layerID = layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
@@ -146,9 +155,9 @@ function createSendTask(name = ''){
|
|||||||
<div class='line'>\
|
<div class='line'>\
|
||||||
<span class='tname'>限速</span>\
|
<span class='tname'>限速</span>\
|
||||||
<div class='info-r c4'>\
|
<div class='info-r c4'>\
|
||||||
<input class='bt-input-text' type='number' name='bwlimit' min='0' value='1024' style='width:100px' /> KB\
|
<input class='bt-input-text' type='number' name='bwlimit' min='0' value='"+bwlimit+"' style='width:100px' /> KB\
|
||||||
<span data-toggle='tooltip' data-placement='top' title='【限速】限制数据同步任务的速度,防止因同步数据导致带宽跑高' class='bt-ico-ask' style='cursor: pointer;'>?</span>\
|
<span data-toggle='tooltip' data-placement='top' title='【限速】限制数据同步任务的速度,防止因同步数据导致带宽跑高' class='bt-ico-ask' style='cursor: pointer;'>?</span>\
|
||||||
<span style='margin-left: 29px;margin-right: 10px;'>延迟</span><input class='bt-input-text' min='0' type='number' name='delay' value='3' style='width:100px' /> 秒\
|
<span style='margin-left: 29px;margin-right: 10px;'>延迟</span><input class='bt-input-text' min='0' type='number' name='delay' value='"+delay+"' style='width:100px' /> 秒\
|
||||||
<span data-toggle='tooltip' data-placement='top' title='【延迟】在延迟时间周期内仅记录不同步,到达周期后一次性同步数据,以节省开销' class='bt-ico-ask' style='cursor: pointer;'>?</span>\
|
<span data-toggle='tooltip' data-placement='top' title='【延迟】在延迟时间周期内仅记录不同步,到达周期后一次性同步数据,以节省开销' class='bt-ico-ask' style='cursor: pointer;'>?</span>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
|
|||||||
+11
-4
@@ -496,10 +496,17 @@ def saveBody(path, data, encoding):
|
|||||||
def sortFileList(path, ftype = 'mtime', sort = 'desc'):
|
def sortFileList(path, ftype = 'mtime', sort = 'desc'):
|
||||||
flist = os.listdir(path)
|
flist = os.listdir(path)
|
||||||
if ftype == 'mtime':
|
if ftype == 'mtime':
|
||||||
if sort == 'desc':
|
try:
|
||||||
flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=True)
|
if sort == 'desc':
|
||||||
if sort == 'asc':
|
flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=True)
|
||||||
flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=False)
|
if sort == 'asc':
|
||||||
|
flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=False)
|
||||||
|
except Exception as e:
|
||||||
|
if sort == 'desc':
|
||||||
|
flist = sorted(flist, key=lambda f: os.path.getctime(os.path.join(path,f)), reverse=True)
|
||||||
|
if sort == 'asc':
|
||||||
|
flist = sorted(flist, key=lambda f: os.path.getctime(os.path.join(path,f)), reverse=False)
|
||||||
|
|
||||||
|
|
||||||
if ftype == 'size':
|
if ftype == 'size':
|
||||||
if sort == 'desc':
|
if sort == 'desc':
|
||||||
|
|||||||
Reference in New Issue
Block a user