mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.3 KiB
70 lines
1.3 KiB
6 years ago
|
# coding:utf-8
|
||
|
|
||
|
import sys
|
||
|
import io
|
||
|
import os
|
||
|
import time
|
||
|
import re
|
||
|
import json
|
||
|
import shutil
|
||
|
|
||
4 years ago
|
# reload(sys)
|
||
|
# sys.setdefaultencoding('utf8')
|
||
6 years ago
|
|
||
|
sys.path.append(os.getcwd() + "/class/core")
|
||
5 years ago
|
import mw
|
||
6 years ago
|
|
||
|
app_debug = False
|
||
5 years ago
|
if mw.isAppleSystem():
|
||
6 years ago
|
app_debug = True
|
||
|
|
||
|
|
||
|
def getPluginName():
|
||
3 years ago
|
return 'php-guard'
|
||
6 years ago
|
|
||
|
|
||
|
def getPluginDir():
|
||
5 years ago
|
return mw.getPluginDir() + '/' + getPluginName()
|
||
6 years ago
|
|
||
|
|
||
|
def getServerDir():
|
||
5 years ago
|
return mw.getServerDir() + '/' + getPluginName()
|
||
6 years ago
|
|
||
|
|
||
|
def getInitDFile(version):
|
||
|
if app_debug:
|
||
|
return '/tmp/' + getPluginName()
|
||
5 years ago
|
return '/etc/init.d/' + getPluginName() + version
|
||
6 years ago
|
|
||
|
|
||
|
def getArgs():
|
||
|
args = sys.argv[3:]
|
||
|
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:
|
||
5 years ago
|
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||
|
return (True, mw.returnJson(True, 'ok'))
|
||
6 years ago
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
func = sys.argv[1]
|
||
|
if func == 'status':
|
||
4 years ago
|
print('start')
|
||
6 years ago
|
else:
|
||
4 years ago
|
print("fail")
|