#!/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 you 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 $Erp01_Server
;;
4)
ssh -p$PROT $Erp02_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