mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:49:26 +08:00
@@ -1,4 +1,4 @@
|
||||
### mdserver-web 0.8.6
|
||||
### mdserver-web 0.9.0
|
||||
|
||||
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
@@ -28,6 +28,7 @@
|
||||
* OpenResty - 轻量级,占有内存少,并发能力强。
|
||||
* PHP[52-81] - PHP是世界上最好的编程语言。
|
||||
* MySQL - 一种关系数据库管理系统。
|
||||
* MariaDB - 是MySQL的一个重要分支。
|
||||
* MongoDB - 一种非关系NOSQL数据库管理系统。
|
||||
* phpMyAdmin - 著名Web端MySQL管理工具。
|
||||
* Memcached - 一个高性能的分布式内存对象缓存系统。
|
||||
@@ -36,6 +37,19 @@
|
||||
* Gogs - 一款极易搭建的自助Git服务。
|
||||
* Rsyncd - 通用同步服务。
|
||||
|
||||
|
||||
### 插件开发相关
|
||||
|
||||
```
|
||||
插件文档还不完善,如果有不明白的地方提Issue! 我会尽力完善。
|
||||
如果你自己写了插件,想分享出来,也可以提Issue。
|
||||
```
|
||||
|
||||
- 简单例子 - https://github.com/mw-plugin/simple-plugin
|
||||
- 插件地址 - https://github.com/mw-plugin
|
||||
- 开发文档 - https://github.com/midoks/mdserver-web/wiki/插件开发
|
||||
|
||||
|
||||
# Note
|
||||
|
||||
```
|
||||
@@ -56,11 +70,23 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.8.6
|
||||
* mysql主从配置。
|
||||
* swap插件[虚拟内存]。
|
||||
### 版本更新 0.9.0
|
||||
* 主流系统支持。
|
||||
* 插件支持更多参数。
|
||||
* MySQL主从支持GTID和经典模式。
|
||||
* MariaDB主从支持GTID和经典模式。
|
||||
* Rsyncd更新。
|
||||
* 添加网站统计的插件。
|
||||
* 添加varnish插件。
|
||||
* 添加PHP的APT安装方式[辅助插件]。
|
||||
* 添加PHP的YUM安装方式[辅助插件]。
|
||||
* 添加MYSQL的YUM安装方式[辅助插件]。
|
||||
* 各种bug修复。
|
||||
|
||||
### jsdelivr [ 发布新版本生效 ]
|
||||
|
||||
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
- 初始安装
|
||||
|
||||
@@ -68,43 +94,31 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
- 更新
|
||||
- 直接更新
|
||||
|
||||
```
|
||||
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh | bash
|
||||
```
|
||||
|
||||
### GW使用
|
||||
### 备用地址
|
||||
|
||||
- 初始安装
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh | bash
|
||||
|
||||
```
|
||||
|
||||
- 脚本更新
|
||||
- 直接更新
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
|
||||
```
|
||||
|
||||
### GN使用
|
||||
|
||||
- 初始安装
|
||||
### 通用软件安装[命令行安装]
|
||||
|
||||
```
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install_cn.sh | bash
|
||||
```
|
||||
|
||||
- 脚本更新
|
||||
|
||||
```
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_cn.sh | bash
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 通用软件安装
|
||||
- 需已经安装mdserver-web
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/app.sh | bash
|
||||
@@ -113,15 +127,8 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/qu
|
||||
|
||||
### DEV使用
|
||||
|
||||
- 初始安装
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash
|
||||
```
|
||||
|
||||
- 脚本更新
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
||||
```
|
||||
|
||||
@@ -134,17 +141,6 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
|
||||
[](/route/static/mdw.jpg)
|
||||
|
||||
|
||||
### 插件开发相关
|
||||
|
||||
```
|
||||
插件文档还不完善,如果有不明白的地方提Issue! 我会尽力完善。
|
||||
如果你自己写了插件,想分享出来,也可以提Issue。
|
||||
```
|
||||
|
||||
- 简单例子 - https://github.com/mw-plugin/simple-plugin
|
||||
- 插件地址 - https://github.com/mw-plugin
|
||||
- 开发文档 - https://github.com/midoks/mdserver-web/wiki/插件开发
|
||||
|
||||
|
||||
### Stargazers over time
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from flask import request
|
||||
class config_api:
|
||||
|
||||
# mariadb 优化
|
||||
__version = '0.8.6.16'
|
||||
__version = '0.9.0'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
# coding: utf-8
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
import psycopg2
|
||||
|
||||
|
||||
class ORM:
|
||||
__DB_PASS = None
|
||||
__DB_USER = 'root'
|
||||
__DB_PORT = 5432
|
||||
__DB_HOST = 'localhost'
|
||||
__DB_CONN = None
|
||||
__DB_CUR = None
|
||||
__DB_ERR = None
|
||||
__DB_CNF = '/etc/my.cnf'
|
||||
__DB_SOCKET = '/www/server/postgresql/mysql.sock'
|
||||
__DB_CHARSET = "utf8"
|
||||
|
||||
def __Conn(self):
|
||||
'''连接数据库'''
|
||||
try:
|
||||
|
||||
try:
|
||||
self.__DB_CONN = psycopg2.connect(database='postgres', user=self.__DB_USER, password=self.__DB_PASS,
|
||||
host=self.__DB_HOST, port=int(self.__DB_PORT))
|
||||
except Exception as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = psycopg2.connect(database='postgres', user=self.__DB_USER, password=self.__DB_PASS,
|
||||
host=self.__DB_HOST, port=int(self.__DB_PORT))
|
||||
|
||||
self.__DB_CUR = self.__DB_CONN.cursor()
|
||||
return True
|
||||
except Exception as e:
|
||||
self.__DB_ERR = e
|
||||
return False
|
||||
|
||||
def setDbConf(self, conf):
|
||||
self.__DB_CNF = conf
|
||||
|
||||
def setSocket(self, sock):
|
||||
self.__DB_SOCKET = sock
|
||||
|
||||
def setCharset(self, charset):
|
||||
self.__DB_CHARSET = charset
|
||||
|
||||
def setPort(self, port):
|
||||
self.__DB_PORT = port
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
def getPwd(self):
|
||||
return self.__DB_PASS
|
||||
|
||||
def execute(self, sql):
|
||||
# 执行SQL语句返回受影响行
|
||||
if not self.__Conn():
|
||||
return self.__DB_ERR
|
||||
try:
|
||||
result = self.__DB_CUR.execute(sql)
|
||||
self.__DB_CONN.commit()
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return ex
|
||||
|
||||
def query(self, sql):
|
||||
# 执行SQL语句返回数据集
|
||||
if not self.__Conn():
|
||||
return self.__DB_ERR
|
||||
try:
|
||||
self.__DB_CUR.execute(sql)
|
||||
result = self.__DB_CUR.fetchall()
|
||||
# print(result)
|
||||
# 将元组转换成列表
|
||||
# data = map(list, result)
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return ex
|
||||
|
||||
def __Close(self):
|
||||
# 关闭连接
|
||||
self.__DB_CUR.close()
|
||||
self.__DB_CONN.close()
|
||||
@@ -1,9 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS `config` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`mysql_root` TEXT
|
||||
`pg_root` TEXT
|
||||
);
|
||||
|
||||
INSERT INTO `config` (`id`, `mysql_root`) VALUES (1, 'admin');
|
||||
INSERT INTO `config` (`id`, `pg_root`) VALUES (1, 'admin');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `databases` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
port = 5432
|
||||
listen_addresses='*'
|
||||
unix_socket_directories='{$APP_PATH}/tmp'
|
||||
|
||||
max_wal_size = 1GB
|
||||
min_wal_size = 80MB
|
||||
|
||||
log_timezone = 'Asia/Shanghai'
|
||||
datestyle = 'iso, ymd'
|
||||
timezone = 'Asia/Shanghai'
|
||||
default_text_search_config = 'pg_catalog.simple'
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- <script type="text/javascript">console.log($('.plugin_version').attr('version'));</script> -->
|
||||
<p class="bgw" onclick="pluginService('postgresql', $('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('postgresql', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="pluginConfig('postgresql', $('.plugin_version').attr('version'));">配置文件</p>
|
||||
<p onclick="pluginConfigTpl('postgresql');">配置文件</p>
|
||||
<!--<p onclick="myDbPos();">存储位置</p> -->
|
||||
<p onclick="pgPort();">端口</p>
|
||||
<!-- <p onclick="runInfo();">当前状态</p>
|
||||
|
||||
+112
-30
@@ -76,10 +76,31 @@ def getConf():
|
||||
return path
|
||||
|
||||
|
||||
def configTpl():
|
||||
|
||||
clist = []
|
||||
|
||||
app_dir = getServerDir()
|
||||
clist.append(app_dir + "/data/postgresql.conf")
|
||||
clist.append(app_dir + "/data/pg_hba.conf")
|
||||
|
||||
return mw.getJson(clist)
|
||||
|
||||
|
||||
def readConfigTpl():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
content = mw.readFile(args['file'])
|
||||
return mw.returnJson(True, 'ok', content)
|
||||
|
||||
|
||||
def getDbPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'port\s*=\s*(.*)'
|
||||
rep = 'port\s*=\s*(\d*)?'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -127,37 +148,42 @@ def pSqliteDb(dbname='databases'):
|
||||
return conn
|
||||
|
||||
|
||||
def pMysqlDb():
|
||||
# pymysql
|
||||
db = mw.getMyORM()
|
||||
# MySQLdb |
|
||||
# db = mw.getMyORMDb()
|
||||
def pgDb():
|
||||
|
||||
sys.path.append(getPluginDir() + "/class")
|
||||
import pg
|
||||
|
||||
db = pg.ORM()
|
||||
|
||||
db.setPort(getDbPort())
|
||||
db.setSocket(getSocketFile())
|
||||
# db.setCharset("utf8")
|
||||
db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('mysql_root'))
|
||||
# db.setSocket(getSocketFile())
|
||||
db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('pg_root'))
|
||||
return db
|
||||
|
||||
|
||||
def initDreplace(version=''):
|
||||
|
||||
conf_dir = getServerDir() + '/etc'
|
||||
log_dir = getServerDir() + "/logs"
|
||||
conf_dir = getServerDir()
|
||||
conf_list = [
|
||||
conf_dir,
|
||||
log_dir
|
||||
conf_dir + "/logs",
|
||||
conf_dir + "/tmp",
|
||||
]
|
||||
for c in conf_list:
|
||||
if not os.path.exists(c):
|
||||
os.mkdir(c)
|
||||
|
||||
# my_conf = conf_dir + '/my.cnf'
|
||||
# if not os.path.exists(my_conf):
|
||||
# tpl = getPluginDir() + '/conf/my.cnf'
|
||||
# content = mw.readFile(tpl)
|
||||
# content = contentReplace(content)
|
||||
# mw.writeFile(my_conf, content)
|
||||
init_pl = conf_dir + "/init.pl"
|
||||
if not os.path.exists(init_pl):
|
||||
# mw.writeFile(init_pl, 'ok')
|
||||
pg_conf = conf_dir + '/data/postgresql.conf'
|
||||
tpl = getPluginDir() + '/conf/postgresql.conf'
|
||||
content = mw.readFile(tpl)
|
||||
content = contentReplace(content)
|
||||
mw.writeFile(pg_conf, content)
|
||||
|
||||
logfile = runLog()
|
||||
if not os.path.exists(logfile):
|
||||
mw.writeFile(logfile, '')
|
||||
|
||||
# systemd
|
||||
system_dir = mw.systemdCfgDir()
|
||||
@@ -179,8 +205,8 @@ def initDreplace(version=''):
|
||||
|
||||
file_bin = initd_path + '/' + getPluginName()
|
||||
if not os.path.exists(file_bin):
|
||||
initd_tpl = getInitdTpl(version)
|
||||
content = mw.readFile(initd_tpl)
|
||||
tpl = getInitdTpl(version)
|
||||
content = mw.readFile(tpl)
|
||||
content = contentReplace(content)
|
||||
mw.writeFile(file_bin, content)
|
||||
mw.execShell('chmod +x ' + file_bin)
|
||||
@@ -249,8 +275,12 @@ def pGetDbUser():
|
||||
|
||||
def initPgData():
|
||||
serverdir = getServerDir()
|
||||
if not os.path.exists(serverdir + '/postgresql'):
|
||||
cmd = 'cd ' + serverdir + ' && ./bin/initdb -D ' + serverdir + "/data"
|
||||
if not os.path.exists(serverdir + '/data'):
|
||||
cmd = serverdir + '/bin/initdb -D ' + serverdir + "/data"
|
||||
if not mw.isAppleSystem():
|
||||
cmd = "echo \"" + serverdir + "/bin/initdb -D " + \
|
||||
serverdir + "/data\" | su - postgresql"
|
||||
# print(cmd)
|
||||
mw.execShell(cmd)
|
||||
return False
|
||||
return True
|
||||
@@ -264,14 +294,14 @@ def initPgPwd():
|
||||
cmd_pass = "echo \"create user root with superuser password '" + pwd + "'\" | "
|
||||
cmd_pass = cmd_pass + serverdir + '/bin/psql -d postgres'
|
||||
data = mw.execShell(cmd_pass)
|
||||
print(cmd_pass)
|
||||
print(data)
|
||||
# print(cmd_pass)
|
||||
# print(data)
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('pg_root', (pwd,))
|
||||
return True
|
||||
|
||||
|
||||
def myOp(version, method):
|
||||
def pgOp(version, method):
|
||||
# import commands
|
||||
init_file = initDreplace()
|
||||
cmd = init_file + ' ' + method
|
||||
@@ -311,7 +341,7 @@ def myOp(version, method):
|
||||
|
||||
|
||||
def appCMD(version, action):
|
||||
return myOp(version, action)
|
||||
return pgOp(version, action)
|
||||
|
||||
|
||||
def start(version=''):
|
||||
@@ -327,6 +357,9 @@ def restart(version=''):
|
||||
|
||||
|
||||
def reload(version=''):
|
||||
logfile = runLog()
|
||||
if os.path.exists(logfile):
|
||||
mw.writeFile(logfile, '')
|
||||
return appCMD(version, 'reload')
|
||||
|
||||
|
||||
@@ -472,9 +505,9 @@ def myDbStatus():
|
||||
result = {}
|
||||
db = pMysqlDb()
|
||||
data = db.query('show variables')
|
||||
isError = isSqlError(data)
|
||||
if isError != None:
|
||||
return isError
|
||||
# isError = isSqlError(data)
|
||||
# if isError != None:
|
||||
# return isError
|
||||
|
||||
gets = ['table_open_cache', 'thread_cache_size', 'key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size',
|
||||
'innodb_additional_mem_pool_size', 'innodb_log_buffer_size', 'max_connections', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size']
|
||||
@@ -672,6 +705,49 @@ def getDbList():
|
||||
return mw.getJson(data)
|
||||
|
||||
|
||||
def syncGetDatabases():
|
||||
pdb = pgDb()
|
||||
psdb = pSqliteDb('databases')
|
||||
data = pdb.query('SELECT * FROM pg_database WHERE datistemplate = false')
|
||||
print(data)
|
||||
return
|
||||
# isError = isSqlError(data)
|
||||
# if isError != None:
|
||||
# return isError
|
||||
users = pdb.query(
|
||||
"select User,Host from mysql.user where User!='root' AND Host!='localhost' AND Host!=''")
|
||||
nameArr = ['information_schema', 'performance_schema', 'mysql', 'sys']
|
||||
n = 0
|
||||
|
||||
# print(users)
|
||||
for value in data:
|
||||
vdb_name = value["Database"]
|
||||
b = False
|
||||
for key in nameArr:
|
||||
if vdb_name == key:
|
||||
b = True
|
||||
break
|
||||
if b:
|
||||
continue
|
||||
if psdb.where("name=?", (vdb_name,)).count() > 0:
|
||||
continue
|
||||
host = '127.0.0.1'
|
||||
for user in users:
|
||||
if vdb_name == user["User"]:
|
||||
host = user["Host"]
|
||||
break
|
||||
|
||||
ps = mw.getMsg('INPUT_PS')
|
||||
if vdb_name == 'test':
|
||||
ps = mw.getMsg('DATABASE_TEST')
|
||||
addTime = time.strftime('%Y-%m-%d %X', time.localtime())
|
||||
if psdb.add('name,username,password,accept,ps,addtime', (vdb_name, vdb_name, '', host, ps, addTime)):
|
||||
n += 1
|
||||
|
||||
msg = mw.getInfo('本次共从服务器获取了{1}个数据库!', (str(n),))
|
||||
return mw.returnJson(True, msg)
|
||||
|
||||
|
||||
def installPreInspection(version):
|
||||
return 'ok'
|
||||
|
||||
@@ -710,6 +786,10 @@ if __name__ == "__main__":
|
||||
print(uninstallPreInspection(version))
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'config_tpl':
|
||||
print(configTpl())
|
||||
elif func == 'read_config_tpl':
|
||||
print(readConfigTpl())
|
||||
elif func == 'run_info':
|
||||
print(runInfo())
|
||||
elif func == 'run_log':
|
||||
@@ -720,5 +800,7 @@ if __name__ == "__main__":
|
||||
print(setPgPort())
|
||||
elif func == 'get_db_list':
|
||||
print(getDbList())
|
||||
elif func == 'sync_get_databases':
|
||||
print(syncGetDatabases())
|
||||
else:
|
||||
print('error')
|
||||
|
||||
@@ -4,12 +4,12 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=postgres
|
||||
Group=postgres
|
||||
User=postgresql
|
||||
Group=postgresql
|
||||
WorkingDirectory={$APP_PATH}
|
||||
ExecStart={$APP_PATH}/pg_ctl start -D {$APP_PATH}/data
|
||||
ExecReload={$APP_PATH}/pg_ctl restart -D {$APP_PATH}/data
|
||||
ExecStop={$APP_PATH}/pg_ctl stop -D {$APP_PATH}/data
|
||||
ExecStart={$APP_PATH}/bin/pg_ctl start -D {$APP_PATH}/data
|
||||
ExecReload={$APP_PATH}/bin/pg_ctl restart -D {$APP_PATH}/data
|
||||
ExecStop={$APP_PATH}/bin/pg_ctl stop -D {$APP_PATH}/data
|
||||
PrivateTmp=false
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -36,10 +36,9 @@ pg_stop()
|
||||
}
|
||||
|
||||
|
||||
|
||||
pg_status()
|
||||
{
|
||||
isStart=$(ps aux |grep 'postgres'|grep -v grep|awk '{print $2}')
|
||||
isStart=$(ps aux | grep 'postgres'| grep -v grep | grep -v 'postgresql status' | awk '{print $2}')
|
||||
if [ "$isStart" != '' ];then
|
||||
echo -e "\033[32mPostgreSQL (pid $isStart) already running\033[0m"
|
||||
else
|
||||
@@ -50,8 +49,8 @@ pg_status()
|
||||
|
||||
pg_reload()
|
||||
{
|
||||
pg_stop
|
||||
pg_start
|
||||
echo '' > {$APP_PATH}/logs/server.log
|
||||
{$APP_PATH}/bin/pg_ctl -D {$APP_PATH}/data -l {$APP_PATH}/logs/server.log reload
|
||||
}
|
||||
|
||||
|
||||
@@ -63,4 +62,6 @@ case "$1" in
|
||||
'restart')
|
||||
pg_stop
|
||||
pg_start;;
|
||||
'status')
|
||||
pg_status;;
|
||||
esac
|
||||
|
||||
@@ -13,6 +13,13 @@ install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
pip install psycopg2-binary
|
||||
if [ -f ${rootPath}/bin/activate ];then
|
||||
source ${rootPath}/bin/activate
|
||||
pip install psycopg2-binary
|
||||
fi
|
||||
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
exit 0
|
||||
@@ -23,20 +30,20 @@ if [ ! -d $curPath/versions/$2 ];then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# if [ "${action}" == "uninstall" ];then
|
||||
# if [ -f /usr/lib/systemd/system/postgresql.service ] || [ -f /lib/systemd/system/postgresql.service ];then
|
||||
# systemctl stop postgresql
|
||||
# systemctl disable postgresql
|
||||
# rm -rf /usr/lib/systemd/system/postgresql.service
|
||||
# rm -rf /lib/systemd/system/postgresql.service
|
||||
# systemctl daemon-reload
|
||||
# fi
|
||||
# fi
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
if [ -f /usr/lib/systemd/system/postgresql.service ] || [ -f /lib/systemd/system/postgresql.service ];then
|
||||
systemctl stop postgresql
|
||||
systemctl disable postgresql
|
||||
rm -rf /usr/lib/systemd/system/postgresql.service
|
||||
rm -rf /lib/systemd/system/postgresql.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
# if [ "${action}" == "install" ] && [ -d $serverPath/postgresql ];then
|
||||
# #初始化
|
||||
# cd ${rootPath} && python3 ${rootPath}/plugins/postgresql/index.py start ${type}
|
||||
# cd ${rootPath} && python3 ${rootPath}/plugins/postgresql/index.py initd_install ${type}
|
||||
# fi
|
||||
if [ "${action}" == "install" ] && [ -d $serverPath/postgresql ];then
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/postgresql/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/postgresql/index.py initd_install ${type}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user