Exit after installing agent (#303)

If entered with install_agent argument, variable IS_DOCKER_NEZHA will not be set, thus leading select menu to appear, which could be annoying.
This commit is contained in:
Applexad 2023-11-30 13:16:39 +08:00 committed by GitHub
parent 2280e0267c
commit b3e38e8924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 20 deletions

View File

@ -363,7 +363,7 @@ modify_agent_config() {
sed -i "s/nz_grpc_host/${nz_grpc_host}/" ${NZ_AGENT_SERVICERC} sed -i "s/nz_grpc_host/${nz_grpc_host}/" ${NZ_AGENT_SERVICERC}
sed -i "s/nz_grpc_port/${nz_grpc_port}/" ${NZ_AGENT_SERVICERC} sed -i "s/nz_grpc_port/${nz_grpc_port}/" ${NZ_AGENT_SERVICERC}
sed -i "s/nz_client_secret/${nz_client_secret}/" ${NZ_AGENT_SERVICERC} sed -i "s/nz_client_secret/${nz_client_secret}/" ${NZ_AGENT_SERVICERC}
[ -n "${args}" ] && sed -i "/command_args/ s/$/ \"${args}\"/" ${NZ_AGENT_SERVICERC} [ -n "${args}" ] && sed -i "/command_args/ s/\"$/ ${args}\"/" ${NZ_AGENT_SERVICERC}
fi fi
echo -e "Agent配置 ${green}修改成功,请稍等重启生效${plain}" echo -e "Agent配置 ${green}修改成功,请稍等重启生效${plain}"
@ -377,9 +377,9 @@ modify_agent_config() {
rc-service nezha-agent restart rc-service nezha-agent restart
fi fi
if [[ $# == 0 ]]; then #if [[ $# == 0 ]]; then
before_show_menu # before_show_menu
fi #fi
} }
modify_dashboard_config() { modify_dashboard_config() {
@ -711,9 +711,6 @@ uninstall_dashboard() {
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
before_show_menu before_show_menu
fi fi
sed -i '/IS_DOCKER_NEZHA/d' ~/.bashrc
} }
uninstall_dashboard_standalone() { uninstall_dashboard_standalone() {
@ -738,9 +735,6 @@ uninstall_dashboard_standalone() {
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
before_show_menu before_show_menu
fi fi
sed -i '/IS_DOCKER_NEZHA/d' ~/.bashrc
} }
show_agent_log() { show_agent_log() {

View File

@ -361,7 +361,7 @@ modify_agent_config() {
sed -i "s/nz_grpc_host/${nz_grpc_host}/" ${NZ_AGENT_SERVICERC} sed -i "s/nz_grpc_host/${nz_grpc_host}/" ${NZ_AGENT_SERVICERC}
sed -i "s/nz_grpc_port/${nz_grpc_port}/" ${NZ_AGENT_SERVICERC} sed -i "s/nz_grpc_port/${nz_grpc_port}/" ${NZ_AGENT_SERVICERC}
sed -i "s/nz_client_secret/${nz_client_secret}/" ${NZ_AGENT_SERVICERC} sed -i "s/nz_client_secret/${nz_client_secret}/" ${NZ_AGENT_SERVICERC}
[ -n "${args}" ] && sed -i "/command_args/ s/$/ \"${args}\"/" ${NZ_AGENT_SERVICERC} [ -n "${args}" ] && sed -i "/command_args/ s/\"$/ ${args}\"/" ${NZ_AGENT_SERVICERC}
fi fi
echo -e "Agent configuration ${green} modified successfully, please wait for agent self-restart to take effect${plain}" echo -e "Agent configuration ${green} modified successfully, please wait for agent self-restart to take effect${plain}"
@ -375,9 +375,9 @@ modify_agent_config() {
rc-service nezha-agent restart rc-service nezha-agent restart
fi fi
if [[ $# == 0 ]]; then #if [[ $# == 0 ]]; then
before_show_menu # before_show_menu
fi #fi
} }
modify_dashboard_config() { modify_dashboard_config() {
@ -709,9 +709,6 @@ uninstall_dashboard() {
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
before_show_menu before_show_menu
fi fi
sed -i '/IS_DOCKER_NEZHA/d' ~/.bashrc
} }
uninstall_dashboard_standalone() { uninstall_dashboard_standalone() {
@ -736,9 +733,6 @@ uninstall_dashboard_standalone() {
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
before_show_menu before_show_menu
fi fi
sed -i '/IS_DOCKER_NEZHA/d' ~/.bashrc
} }
show_agent_log() { show_agent_log() {