mirror of https://github.com/midoks/mdserver-web
parent
48b2c4a35e
commit
2ddcc3227b
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,7 @@ |
|||||||
|
|
||||||
|
<script type="text/javascript"> |
||||||
|
setTimeout(function(){ |
||||||
|
layer.closeAll(); |
||||||
|
layer.msg('PHP守护已启动,无需设置',{icon:1,time:2000,shade: [0.3, '#000']}); |
||||||
|
},1); |
||||||
|
</script> |
@ -0,0 +1,71 @@ |
|||||||
|
# coding:utf-8 |
||||||
|
|
||||||
|
import sys |
||||||
|
import io |
||||||
|
import os |
||||||
|
import time |
||||||
|
import re |
||||||
|
import json |
||||||
|
import shutil |
||||||
|
|
||||||
|
reload(sys) |
||||||
|
sys.setdefaultencoding('utf8') |
||||||
|
|
||||||
|
sys.path.append(os.getcwd() + "/class/core") |
||||||
|
sys.path.append("/usr/local/lib/python2.7/site-packages") |
||||||
|
|
||||||
|
import public |
||||||
|
|
||||||
|
app_debug = False |
||||||
|
if public.isAppleSystem(): |
||||||
|
app_debug = True |
||||||
|
|
||||||
|
|
||||||
|
def getPluginName(): |
||||||
|
return 'php_guard' |
||||||
|
|
||||||
|
|
||||||
|
def getPluginDir(): |
||||||
|
return public.getPluginDir() + '/' + getPluginName() |
||||||
|
|
||||||
|
|
||||||
|
def getServerDir(): |
||||||
|
return public.getServerDir() + '/' + getPluginName() |
||||||
|
|
||||||
|
|
||||||
|
def getInitDFile(version): |
||||||
|
if app_debug: |
||||||
|
return '/tmp/' + getPluginName() |
||||||
|
return '/etc/init.d/' + getPluginName()+version |
||||||
|
|
||||||
|
|
||||||
|
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: |
||||||
|
return (False, public.returnJson(False, '参数:(' + ck[i] + ')没有!')) |
||||||
|
return (True, public.returnJson(True, 'ok')) |
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__": |
||||||
|
func = sys.argv[1] |
||||||
|
if func == 'status': |
||||||
|
print 'start' |
||||||
|
else: |
||||||
|
print "fail" |
@ -0,0 +1,18 @@ |
|||||||
|
{ |
||||||
|
"sort": 7, |
||||||
|
"ps": "监控PHP-FPM运行状态,防止大批量出现502错误!", |
||||||
|
"shell": "install.sh", |
||||||
|
"name": "php_guard", |
||||||
|
"title": "PHP守护", |
||||||
|
"versions": "1.0", |
||||||
|
"updates": "1.0", |
||||||
|
"tip": "soft", |
||||||
|
"checks": "server/php_guard", |
||||||
|
"path": "server/php/VERSION", |
||||||
|
"display": 1, |
||||||
|
"author": "midoks", |
||||||
|
"date": "2019-03-01", |
||||||
|
"home": "https://github.com/midoks", |
||||||
|
"type": "语言解释器", |
||||||
|
"pid": "1" |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
#!/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") |
||||||
|
|
||||||
|
install_tmp=${rootPath}/tmp/mw_install.pl |
||||||
|
|
||||||
|
|
||||||
|
Install_pg() |
||||||
|
{ |
||||||
|
echo 'install scripts ...' > $install_tmp |
||||||
|
|
||||||
|
|
||||||
|
echo 'True' > ${rootPath}/data/502Task.pl |
||||||
|
|
||||||
|
mkdir -p $serverPath/php_guard |
||||||
|
echo '1.0' > $serverPath/php_guard/version.pl |
||||||
|
|
||||||
|
echo 'install ok' > $install_tmp |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_pg() |
||||||
|
{ |
||||||
|
rm -rf ${rootPath}/data/502Task.pl |
||||||
|
rm -rf $serverPath/php_guard |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
action=$1 |
||||||
|
host=$2 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_pg |
||||||
|
else |
||||||
|
Uninstall_pg |
||||||
|
fi |
Loading…
Reference in new issue