diff --git a/.gitignore b/.gitignore index 1f01fc2e6..aae13447a 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,4 @@ pyvenv.cfg include data/api_login.txt data/sessions -data/ssl.pl +data/ssl.pl diff --git a/mw-cli b/mw-cli new file mode 100644 index 000000000..8d5f63f10 --- /dev/null +++ b/mw-cli @@ -0,0 +1,81 @@ +#!/www/server/mdserver-web/bin/python +# description: mdserver-web cli tools +# ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli +import os +import sys + + +def mw_start(): + """ + Start mdserver-web + """ + os.system('systemctl start mw') + print("服务已启动") + + +def mw_stop(): + """ + stop mdserver-web + """ + os.system('systemctl stop mw') + print("服务已停止") + + +def mw_restart(): + """ + restart mdserver-web + """ + os.system('systemctl restart mw') + print("服务已重启") + + +def mw_reset_username(): + """ + reset mdserver-web username + """ + from tools import set_panel_username + user_name = input("请输入新的用户名: ") + set_panel_username(user_name) + + +def mw_reset_pwd(): + """ + reset mdserver-web password + """ + from tools import set_panel_pwd + pwd = input("请输入新的密码: ") + set_panel_pwd(pwd, True) + + +if __name__ == '__main__': + os.chdir("/www/server/mdserver-web") + sys.path.append(os.getcwd() + "/class/core") + + try: + str = ''' + ==== mdserver-web cli tools ==== + 1. 启动服务 2. 停止服务 + 3. 重启服务 4. 修改用户名 + 5. 修改密码 + ================================= + ''' + if len(sys.argv) == 2: + sw = sys.argv[1] + else: + print(str) + sw = input("请输入您要进行的操作: ") + + if sw == '1': + mw_start() + elif sw == '2': + mw_stop() + elif sw == '3': + mw_restart() + elif sw == '4': + mw_reset_username() + elif sw == '5': + mw_reset_pwd() + else: + print("操作不存在") + except KeyboardInterrupt: + print("\n操作已终止") diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 3676c3bc5..53ae30979 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -43,8 +43,7 @@ Install_openresty() --with-http_slice_module \ --with-http_stub_status_module && make && make install && \ echo "${VERSION}" > $serverPath/openresty/version.pl - - + echo "" > $serverPath/web_conf/nginx/enable-php-00.conf echo '安装完成' > $install_tmp } diff --git a/plugins/xhprof/install.sh b/plugins/xhprof/install.sh index 14af37c44..938a854d7 100755 --- a/plugins/xhprof/install.sh +++ b/plugins/xhprof/install.sh @@ -26,6 +26,7 @@ Uninstall_xh() { rm -rf ${serverPath}/xhprof cd /tmp/xhprof && rm -rf *.xhprof + rm -f /www/server/web_conf/nginx/vhost/xhprof.conf echo '卸载完成' > $install_tmp } diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index 4c5192f11..c59f86a7f 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -185,13 +185,14 @@ case "$1" in if [ -f $mw_path/data/admin_path.pl ];then auth_path=$(cat $mw_path/data/admin_path.pl) fi - if [ "$address" = "" ];then - address=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress) + if [ "$address" = "" ];then + address=$(curl -sS --connect-timeout 10 -m 60 https://v6r.ipip.net/?format=text) fi + echo -e "==================================================================" echo -e "\033[32mMW-Panel default info!\033[0m" echo -e "==================================================================" - echo "MW-Panel-URL: http://$address:$port$auth_path" + echo -e "MW-Panel-URL: http://$address:$port$auth_path" echo -e `python3 $mw_path/tools.py username` echo -e "password: $password" echo -e "\033[33mWarning:\033[0m" @@ -199,4 +200,4 @@ case "$1" in echo -e "\033[33mrelease the following port (7200|888|80|443|20|21) in the security group\033[0m" echo -e "==================================================================" ;; -esac \ No newline at end of file +esac diff --git a/scripts/install.sh b/scripts/install.sh index 44552dddb..25f0f0f00 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -74,7 +74,9 @@ fi echo "use system version: ${OSNAME}" curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install/${OSNAME}.sh | bash +chmod +x /www/server/mdserver-web/mw-cli +ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli endTime=`date +%s` ((outTime=(${endTime}-${startTime})/60)) -echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" \ No newline at end of file +echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"