Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
midoks committed Oct 1, 2024
1 parent 30454e3 commit 3834a9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/postgresql/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@ def setDbBackup():
os.system(cmd)
return mw.returnJson(True, 'ok')

def rootPwd():
return pSqliteDb('config').where('id=?', (1,)).getField('pg_root')

def importDbBackup():
args = getArgs()
Expand Down Expand Up @@ -1589,6 +1591,8 @@ def uninstallPreInspection(version):
print(getPgPort())
elif func == 'set_pg_port':
print(setPgPort())
elif func == 'root_pwd':
print(rootPwd())
elif func == 'get_db_list':
print(getDbList())
elif func == 'add_db':
Expand Down
14 changes: 14 additions & 0 deletions scripts/init.d/mw.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,20 @@ mw_connect_mysql(){
if [ "$CHOICE_DB" == "mysql-yum" ];then
${ROOT_PATH}/mysql-yum/bin/usr/bin/mysql -S ${ROOT_PATH}/mysql-yum/mysql.sock -uroot -p"${pwd}"
fi
}


mw_connect_pgdb(){

if [ ! -d "${ROOT_PATH}/postgresql" ];then
echo -e "postgresql not install!"
exit 1
fi


pwd=$(cd ${ROOT_PATH}/mdserver-web && python3 ${ROOT_PATH}/mdserver-web/plugins/postgresql/index.py root_pwd)
echo "${ROOT_PATH}/postgresql/bin/pgsql -U postgres root -p"${pwd}""
${ROOT_PATH}/postgresql/bin/pgsql -U postgres root -p"${pwd}"
}


Expand Down Expand Up @@ -506,6 +519,7 @@ case "$1" in
'debug') mw_debug;;
'mirror') mw_mirror;;
'db') mw_connect_mysql;;
'pgdb') mw_connect_pgdb;;
'redis') mw_redis;;
'mongodb') mw_mongodb;;
'venv') mw_update_venv;;
Expand Down

0 comments on commit 3834a9b

Please sign in to comment.