Linux下Dialog+Shell三层目录专业规范跳板机脚本推荐

#Dialog+Shell介绍

Dialog+Shell结合使用,方能体现出Dialog图形化的效果,在运维的时候,使用图形化界面,能给你一个更直观的感受,相信你会喜欢上他的

#创建脚本目录

[root@localhost~]#mkdir-p/scripts/tiaoban/{qqandroid,qqios,qqwxandroid,wxios,menu_list}

#禁止普通用户登陆

[root@localhost~]#cat/etc/profile.d/tiaoban.sh[$UID-ne0] sh/scripts/tiaoban/tiaoban.sh

#脚本目录结构

[root@localhosttiaoban]#tree/scripts/tiaoban//scripts/tiaoban/├──menu_list│├──one_menu│└──one_option├──qqandroid│├──three_directory││├──ip.txt││├──three_1_100_tiaoban.sh││├──three_menu││└──three_option│├──tow_menu│├──tow_option│└──tow_tiaoban.sh├──qqios├──qqwxandroid├──tiaoban.sh└──wxios6directories,10files

#添加权限

[root@localhosttiaoban]#chmod+x/scripts/tiaoban/menu_list/{one_menu,one_option}[root@localhosttiaoban]#chmod+x/scripts/tiaoban/qqandroid/{tow_menu,tow_option}[root@localhosttiaoban]#chmod+x/scripts/tiaoban/qqandroid/three_directory/{three_menu,three_option}

#第一层目录脚本

[root@localhosttiaoban]#cattiaoban.sh#!/bin/bashwhile:sttysusp^@#$#屏蔽Crtl+zsttyintr^@$##屏蔽Ctrl+csttyquit^*#$#屏蔽Ctrl+lLJ=`dirname$0`dialog--title"Menu"--no-cancel--menu"Leveldirectory"12355`cat$LJ/menu_list/one_menu`2 $LJ/menu_list/one_optionSELECT=`cat$LJ/menu_list/one_option`if["$SELECT"==1];thensh$LJ/qqandroid/tow_tiaoban.shelif["$SELECT"==2];thensh$LJ/qqios/tow_tiaoban.shelif["$SELECT"==3];thensh$LJ/wxandroid/tow_tiaoban.shsh$LJ/wxios/tow_tiaoban.shdone

#第一层目录菜单

[root@localhosttiaoban]#cat/scripts/tiaoban/menu_list/one_menu1qqandroid2qqios(功能未开发)3wxandroid(功能未开发)4wxios(功能未开发)

#第二层目录脚本

[root@localhosttiaoban]#cat/scripts/tiaoban/qqandroid/tow_tiaoban.sh#!/bin/bashwhile:LJ=`dirname$0`dialog--title"Menu"--menu"Secondarydirectory"133515`cat$LJ/tow_menu`2 $LJ/tow_optionSELECT=`cat$LJ/tow_option`if["$SELECT"==1];thensh$LJ/three_directory/three_1_100_tiaoban.shelif["$SELECT"==2];thensh$LJ/three_directory/three_101_200_tiaoban.shelif["$SELECT"-eq3];thensh$LJ/three_directory/three_201_300_tiaoban.shelsesh/scripts/tiaoban/tiaoban.shdone

#第二层目录菜单

[root@localhosttiaoban]#cat/scripts/tiaoban/qqandroid/tow_menu1qqandroid1-100服2qqandroid101-200服(功能未开发)3qqandroid201-300服(功能未开发)4返回上一级

#第三层目录脚本

[root@localhosttiaoban]#cat/scripts/tiaoban/qqandroid/three_directory/three_1_100_tiaoban.sh#!/bin/bashwhile:LJ=`dirname$0`dialog--title"Menu"--menu"Threedirectory"133515`cat$LJ/three_menu`2 $LJ/three_optionSELECT=`cat$LJ/three_option`functionconnect(){yh=`id`user=`echo$yh|awk-F""'{print$2}'|awk-F"gid="'{print$2}'|awk-F"("'{print$2}'|awk-F")"'{print$1}'`ip=`head-$SELECT$LJ/ip.txt|tail-1`ssh-p22$user@$ipif["$SELECT"==5];thensh/scripts/tiaoban/qqandroid/tow_tiaoban.shelif["$SELECT"==6];thensh/scripts/tiaoban/tiaoban.shconnectdone

第三层目录菜单

[root@localhosttiaoban]#cat/scripts/tiaoban/qqandroid/three_directory/three_menu1qq1服2qqandroid2服(功能未开发)3qqandroid3服(功能未开发)4qqandroid...服(功能未开发)5返回上一级目录6返回首页

#IP文件展示

[root@localhosttiaoban]#cat/scripts/tiaoban/qqandroid/three_directory/ip.txt192.168.1.103192.168.1.104192.168.1.105192.168.1.106192.168.1.107192.168.1.108192.168.1.109192.168.1.110192.168.1.111192.168.1.112

#执行效果展示

1)普通用户登陆

2)第一级菜单栏

3)第二级菜单栏

4)第三级菜单栏

5)成功登陆展示

提示:在用普通用户登陆跳板机连接后端服务器的时候,普通用户按Crtl+c和Ctrl+z是没有效果的,所以普通用户只能直接连接到后端的服务器而不能直接登陆到跳板机终端

风景如何,其实并不重要。重要的是,你在我的身边。

Linux下Dialog+Shell三层目录专业规范跳板机脚本推荐

相关文章:

你感兴趣的文章:

标签云: