🎨 chore: 增强脚本功能
This commit is contained in:
parent
6bf1233ce8
commit
b44e331659
@ -380,6 +380,16 @@ uninstall_agent() {
|
||||
fi
|
||||
}
|
||||
|
||||
restart_agent() {
|
||||
echo -e "> 重启Agent"
|
||||
|
||||
systemctl restart nezha-agent.service
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
before_show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
clean_all() {
|
||||
if [ -z "$(ls -A ${NZ_BASE_PATH})" ]; then
|
||||
rm -rf ${NZ_BASE_PATH}
|
||||
@ -401,6 +411,7 @@ show_usage() {
|
||||
echo "./nbdomain.sh install_agent - 安装监控Agent"
|
||||
echo "./nbdomain.sh modify_agent_config - 修改Agent配置"
|
||||
echo "./nbdomain.sh uninstall_agent - 卸载Agen"
|
||||
echo "./nbdomain.sh restart_agent - 重启Agen"
|
||||
echo "--------------------------------------------------------"
|
||||
}
|
||||
|
||||
@ -421,8 +432,9 @@ show_menu() {
|
||||
${green}8.${plain} 安装监控Agent
|
||||
${green}9.${plain} 修改Agent配置
|
||||
${green}10.${plain} 卸载Agent
|
||||
${green}11.${plain} 重启Agent
|
||||
"
|
||||
echo && read -p "请输入选择 [0-8]: " num
|
||||
echo && read -p "请输入选择 [0-11]: " num
|
||||
|
||||
case "${num}" in
|
||||
0)
|
||||
@ -458,8 +470,11 @@ show_menu() {
|
||||
10)
|
||||
uninstall_agent
|
||||
;;
|
||||
11)
|
||||
restart_agent
|
||||
;;
|
||||
*)
|
||||
echo -e "${red}请输入正确的数字 [0-7]${plain}"
|
||||
echo -e "${red}请输入正确的数字 [0-11]${plain}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@ -498,6 +513,9 @@ if [[ $# > 0 ]]; then
|
||||
"uninstall_agent")
|
||||
uninstall_agent 0
|
||||
;;
|
||||
"restart_agent")
|
||||
restart_agent 0
|
||||
;;
|
||||
*) show_usage ;;
|
||||
esac
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user