#!/bin/bash
Wap_server= "10.0.0.1"
Mem_server= "10.0.0.2"
Erp01_server= "10.0.0.3"
Erp02_server= "10.0.0.4"
Erpold_server= "10.0.0.5"
Backup_server= "10.0.0.6"
Monitor_server= "10.0.0.7"
Dossh=/home/lichuang/scrips/dossh.sh #这是一个远程ssh批量远程执行的脚本
Prot=22
function CheckUser () {
If [$UID-ne 888]
Then
Echo ' PLS SU-888 '
Exit
Fi
function MENU () {
Echo-e "\033[1;32m <<ailyun jume menu>> \033[0m"
Cat <<eof
##########################################
1.Administration All server
2.Connect one server
3.Exit
##########################################
Eof
}
function First () {
Clear
Echo-e "\033[1;32m <<ailyun jume Administration menu>> \033[0m"
MENU
Read-p "Please input num:" num
Case $num in
1)
Admin_server
;;
2)
Connect_server
;;
3)
Exit
;;
*)
Clear
Echo-e "\033[31m############################################\033[0m"
Echo-e "\033[31m#\033[0m" "\033[1;5;31m input error Num, please input again \033[0m" "\033[31m #\033[0m"
Echo-e "\033[31m############################################\033[0m"
Sleep 3
First
Esac
}
function Admin_menu () {
Echo-e "\033[1;32m <<ailyun jume Administration menu>> \033[0m"
Cat <<eof
##########################################
1.df-h
2.free-m
3.uptime
4.iostat
5.ifconfig
6.OTHER what want
7.Return to the upper menu
8.Exit
##########################################
Eof
}
function Admin_server () {
Clear
Admin_menu
Read-p "Please input num:" num
Case $num in
1)
/bin/bash $DOSSH "Df-h"
Admin_server
;;
2)
/bin/bash $DOSSH "Free-m"
Admin_server
;;
3)
/bin/bash $DOSSH "Uptime"
Admin_server
;;
4)
/bin/bash $DOSSH "Iostat"
Admin_server
;;
5)
/bin/bash $DOSSH "Ifconfig"
Admin_server
;;
6)
echo "Temporarily not supported sorry"
Admin_server
;;
7)
First
;;
8)
Exit
;;
*)
Clear
Echo-e "\033[31m############################################\033[0m"
Echo-e "\033[31m#\033[0m" "\033[1;5;31m input error Num, please input again \033[0m" "\033[31m #\033[0m"
Echo-e "\033[31m############################################\033[0m"
Sleep 3
Admin_server
Esac
}
function Connect_menu () {
Echo-e "\033[1;32m <<ailyun jume connect menu>> \033[0m"
Cat <<eof
============================================
1. Wap__$wap_server
2. Mem__$mem_server
3. Erp01__$erp01_server
4. Erp02__$erp02_server
5. Erpold__$erpold_server
6. Backup__$backup_server
7. Monitor__$monitor_server
8. Return to the upper menu
9. Exit
============================================
Eof
}
function Connect_server () {
Clear
Connect_menu
Read-p "Please input num:" num
Case $num in
1)
Ssh-p$prot $Wap _server
;;
2)
Ssh-p$prot $Mem _server
;;
3)
Ssh-p$prot $ERP 01_server
;;
4)
Ssh-p$prot $ERP 02_server
;;
5)
Ssh-p$prot $ErpOld _server
;;
6)
Ssh-p$prot $Backup _server
;;
7)
Ssh-p$prot $Monitor _server
;;
8)
First
;;
9)
Clear
Exit
;;
*)
Clear
Echo-e "\033[31m############################################\033[0m"
Echo-e "\033[31m#\033[0m" "\033[1;5;31m input error Num, please input again \033[0m" "\033[31m #\033[0m"
Echo-e "\033[31m############################################\033[0m"
Sleep 3
Server
Esac
}
Main () {
CheckUser
First
}
Main
This article is from the "10886311" blog, please be sure to keep this source http://10896311.blog.51cto.com/10886311/1714754
Shell menu (Springboard Management and connection scripts)