跳板机的定义:
跳板机就是一台服务器,开发或运维人员在维护过程中首先要统一登录到这台服务器,然后再登录到目标设备进行维护和操作:
jumpserver原理图:
#!/usr/bin/bash
server01=192.168.80.157
server02=192.168.80.130
clear
trap "echo 'sorry! i have trapped ctrl-c!'" SIGINT
while :
do
clear
cat <<-efo
+-------------------------------+
| jumpserver |
| 1) server01 |
| 2) server02 |
+-------------------------------+
efo
echo -en "\e[32minput number: \e[0m "
read num
case "$num" in
1)
ssh long@"$server01"
;;
2)
ssh long@"$server02"
;;
'')
;;
*)
echo "error"
sleep 2 ;;
esac
done
trap "echo 'sorry! i have trapped ctrl-c!'" SIGINT
捕获用户的信号,SIGINT终止进程
网友评论