From a11b49befe2f23233053564ea85f67930725d68e Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 18 Dec 2024 12:17:36 +0800 Subject: [PATCH] update --- cmd.md | 1 + scripts/init.d/mw.tpl | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/cmd.md b/cmd.md index 9e3c6c260..8763cc397 100644 --- a/cmd.md +++ b/cmd.md @@ -7,6 +7,7 @@ mw default | 显示登录信息 mw db | 快捷连接MySQL mw redis | 快捷连接Redis +mw valkey | 快捷连接valkey mw mongodb | 快捷连接MongoDB mw pgdb | 快捷连接PostgreSQL ---------------------------------------- diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index e1e1c8956..02aef4a1d 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -515,6 +515,24 @@ mw_redis(){ ${CLIEXEC} } +mw_valkey(){ + CONF="${ROOT_PATH}/valkey/valkey.conf" + + if [ ! -f "$CONF" ]; then + echo -e "not install valkey!" + exit 1 + fi + + REDISPORT=$(cat $CONF |grep port|grep -v '#'|awk '{print $2}') + REDISPASS=$(cat $CONF |grep requirepass|grep -v '#'|awk '{print $2}') + if [ "$REDISPASS" != "" ];then + REDISPASS=" -a $REDISPASS" + fi + CLIEXEC="${ROOT_PATH}/valkey/bin/valkey-cli -p $REDISPORT$REDISPASS" + echo $CLIEXEC + ${CLIEXEC} +} + mw_venv(){ cd ${PANEL_DIR} && source bin/activate } @@ -622,6 +640,7 @@ case "$1" in 'db') mw_connect_mysql;; 'pgdb') mw_connect_pgdb;; 'redis') mw_redis;; + 'valkey')mw_valkey;; 'mongodb') mw_mongodb;; 'venv') mw_update_venv;; 'clean_lib') mw_clean_lib;;