15 插件开发
Mr Chen edited this page 2022-07-13 12:35:57 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

插件开发。

插件文件(安装包)一般在 /www/server/mdserver-web/plugins

安装后 将会在 /www/server 目录下创建同名文件夹, 且需向插件目录下的version.pl中写入插件版本

最少文件

index.html
info.json
index.py
ico.png
install.sh

ico.png 图片比例24/20

常规操作

当你的服务需要长时间运行一般会创建init.d文件在里面创建服务所需要的模板。为生成systemd的配置文件。
一般在/usr/lib/systemd/system里。

info.json

{
	"id":3,
	"title":"系统优化",
	"tip":"soft",
	"name":"sys-opt",
	"type":"扩展",
	"ps":"仅Linux系统优化",
	"versions":"1.0",
	"shell":"install.sh",
	"checks":"server/sys-opt",
	"path": "server/sys-opt",
	"author":"midoks",
        "install_pre_inspection":false,
        "uninstall_pre_inspection":false,
	"home":"",
	"date":"2018-12-20",
	"pid":"4"
}

ps:注释
title:名称
pid:类型[0-5]
1-运行环境
2-数据软件
3-代码管理
4-系统工具
5-其他插件
6-辅助插件

versions:有两种形式。
{
...
"versions":["5.5", "5.6", "5.7","8.0"],
...
or
...
"versions":"1.0",
...
}


install_pre_inspection
安装接口检查
uninstall_pre_inspection
卸载接口检查

页面JS方法说明

pluginService('redis')
将调用 /www/server/mdserver-web/redis/index.py {start|stop|status}

pluginInitD('redis')
将调用 /www/server/mdserver-web/redis/index.py {initd_start|initd_stop|initd_status}

例子