whiptail到底是个什么进程?

服务器维护过程中遇到whiptail进程导致SSH连接异常断开,该进程CPU占用高达100%,通过kill命令终止进程并计划后续进行详细调查。

今天维护服务器,SSH老是莫名其妙的断开,上去TOP命令一看有个whiptail的进程,CPU一直100%占用,

-----------------------------------------------------------------------------------------------

28048 root 25 0 3264 1440 816 R 100 0.0 52902:15 whiptail

先kill 28048再说,后续查查资料,严明其真身。

dx=`whiptail --title "Welcome to niubi jump server" --checklist \ "做出选择,空格确定" 15 30 4 \ "send" "发送文件" ON \ "useradd" "创建用户" OFF \ "ssh" "远程连接" OFF \ "mem" "查看内存" OFF 3>&1 1>&2 2>&3` case $dx in send) src=`whiptail --title "Welcome to the jump server" --inputbox "输入源文件路径" 15 30 /etc/passwd 3>&1 1>&2 2>&3` dest=`whiptail --title "Welcome to the jump server" --inputbox "输入对端路径" 15 30 /etc/passwd 3>&1 1>&2 2>&3` mu=$(whiptail --title "Welcome to the jump server" --menu "根据菜单选择" 15 30 6\ "1" "web01" \ "2" "web02" \ "3" "lb01" \ "4" "lb02" \ "5" "nfs" \ "6" "backup" 2>&1 >/dev/tty | tr -d '"') if [[ -z "$mu" ]]; then echo "操作已取消" >&2 exit 1 elif ! [[ "$mu" =~ ^[0-9]+$ ]]; then echo "错误:无效选择 '$mu'" >&2 exit 1 fi if [ "$mu" -eq 1 ];then scp $src 172.16.1.7:$dest elif [ "$mu" -eq 2 ];then scp $src 172.16.1.8:$dest elif [ "$mu" -eq 3 ];then scp $src 172.16.1.51:$dest elif [ "$mu" -eq 4 ];then scp $src 172.16.1.71:$dest elif [ "$mu" -eq 5 ];then scp $src 172.16.1.31:$dest elif [ "$mu" -eq 6 ];then scp "$src" 172.16.1.41:$dest else echo '请在规定菜单中进行选择' fi ;; useradd) user=`whiptail --title "Welcome to the jump server" --inputbox "输入用户名" 15 30 gty 3>&1 1>&2 2>&3` pass=$(whiptail --title "设置密码" --passwordbox "请输入密码" 15 30 3>&1 1>&2 2>&3) mu=$(whiptail --title "Welcome to the jump server" --menu "根据菜单选择" 15 30 6\ "1" "web01" \ "2" "web02" \ "3" "lb01" \ "4" "lb02" \ "5" "nfs" \ "6" "backup" 2>&1 >/dev/tty | tr -d '"') if [[ -z "$mu" ]]; then echo "操作已取消" >&2 exit 1 elif ! [[ "$mu" =~ ^[0-9]+$ ]]; then echo "错误:无效选择 '$mu'" >&2 exit 1 fi if [ "$mu" -eq 1 ];then scp $src 172.16.1.7:$dest elif [ "$mu" -eq 2 ];then scp $src 172.16.1.8:$dest elif [ "$mu" -eq 3 ];then scp $src 172.16.1.51:$dest elif [ "$mu" -eq 4 ];then scp $src 172.16.1.71:$dest elif [ "$mu" -eq 5 ];then scp $src 172.16.1.31:$dest elif [ "$mu" -eq 6 ];then scp "$src" 172.16.1.41:$dest else echo '请在规定菜单中进行选择' fi ;; useradd) user=`whiptail --title "Welcome to the jump server" --inputbox "输入用户名" 15 30 gty 3>&1 1>&2 2>&3` pass=$(whiptail --title "设置密码" --passwordbox "请输入密码" 15 30 3>&1 1>&2 2>&3) mu=$(whiptail --title "Welcome to the jump server" --menu "根据菜单选择" 15 30 6\ "1" "web01" \ "2" "web02" \ "3" "lb01" \ "4" "lb02" \ "5" "nfs" \ "7" "backup" 2>&1 >/dev/tty | tr -d '"') case $mu in 1) ip=172.16.1.7 ;; 2) ip=172.16.1.8 ;; 3) ip=172.16.1.51 ;; 4) ip=172.16.1.71 ;; 5) ip=172.16.1.31 ;; 6) ip=172.16.1.41 ;; *) echo "已取消"; exit 0 ;; esac # 创建用户 ssh root@$ip "useradd $user && echo '$user:$pass' | chpasswd" echo "用户 $user 已在 $ip 上创建" esac 为什会直接退出
最新发布
09-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值