演示效果:
1、一级菜单
2、二级菜单
3、执行操作
脚本参考:
复制代码 代码如下:
#!/bin/bash
#author lic(oldboy linux student)
#date 1304
DISK_NO="/dev/sda1"
NGINX_DIR="/usr/local/tdoa/nginx/sbin/nginx"
MYSQL_DIR="/usr/local/tdoa/mysql/bin/mysqld_safe"
SERVER1="WEB"
SERVER2="MYSQL"
SERVER1_START="/usr/local/tdoa/nginx/sbin/nginx"
SERVER1_STOP="kill -QUIT `cat /usr/local/tdoa/logs/nginx/nginx.pid`"
SERVER1_RESTART="kill -HUP `cat /usr/local/tdoa/logs/nginx/nginx.pid`"
SERVER2_START="/etc/init.d/mysql start"
SERVER2_STOP="/etc/init.d/mysql stop"
SERVER2_RESTART="/etc/init.d/mysql restart"
#date
DATE=`date +"%y-%m-%d %H:%M:%S"`
#ip
IPADDR=`ifconfig eth0|grep 'inet addr'|sed 's/^.*addr://g' |sed 's/Bcast:.*$//g'`
#hostname
HOSTNAME=`hostname -s`
#user
USER=`whoami`
#disk_check
DISK_SDA=`df -h | grep $DISK_NO | awk '{print $5}'`
#cpu_average_check
cpu_uptime=`cat /proc/loadavg | cut -c1-14`
#process_check
function process_check() {
for dir in $NGINX_DIR $MYSQL_DIR
do
process_count=$(ps -ef | grep "$dir" | grep -v grep | wc -l)
for service in nginx mysql
do
echo "$dir" |grep -q "$service"
if [ $"$service.......................[NOT RUN]"
else
echo "$service.......................[RUNNING]"
continue
fi
fi
done
done
}
declare flag=0
clear
while [ "$flag" -eq 0 ]
do
echo "========================================"
process_check
echo "========================================"
cat << EOF
|-----------System Infomation-----------
| DATE :$DATE
| HOSTNAME :$HOSTNAME
| USER :$USER
| IP :$IPADDR
| DISK_USED :$DISK_SDA
| CPU_AVERAGE:$cpu_uptime
----------------------------------------
|****Please Enter Your Choice:[0-5]****|
----------------------------------------
(1) Configure $SERVER1 Service
(2) Configure $SERVER2 Service
(3) Configure NETWORKE Service
(4) Change Passwd
(5) Logs
(0) Quit
EOF
read -p "Please enter your choice[0-5]: " input
case $input in
#web service
1)
clear
while [ "$flag" -eq 0 ]
do
cat << EOF
----------------------------------------
|****Please Enter Your Choice:[0-3]****|
----------------------------------------
(1) Start $SERVER1 Service
(2) Stop $SERVER1 Service
(3) ReStart $SERVER1 Service
(0) Back
EOF
read -p "Please enter your choice[0-3]: " input1
case $input1 in
1)
echo -e "\n>$DATE Start $SERVER1"/log.txt
$SERVER1_START 2/log.txt
if [ $"Start $SERVER1......................................................[OK]"
else
echo "Start $SERVER1......................................................[FAILED]"
fi
sleep 5
clear
;;
2)
echo -e "\n>$DATE Stop $SERVER1"/log.txt
$SERVER1_STOP 2/log.txt
if [ $"Stop $SERVER1.......................................................[OK]"
else
echo "Stop $SERVER1.......................................................[FAILED]"
fi
sleep 5
clear
;;
3)
echo -e "\n>$DATE ReStart $SERVER1"/log.txt
/usr/local/tdoa/php/sbin/php-fpm restart 2/log.txt
$SERVER1_RESTART 2/log.txt
if [ $"Restart $SERVER1....................................................[OK]"
else
echo "Restart $SERVER1....................................................[FAILED]"
fi
sleep 5
clear
;;
0)
clear
break
;;
*) echo "----------------------------------"
echo "| Warning!!! |"
echo "| Please Enter Right Choice! |"
echo "----------------------------------"
for i in `seq -w 10 -1 1`
do
echo -ne "\b\b$i";
sleep 1;
done
clear
;;
esac
done
;;
#mysql service
2)
clear
while [ "$flag" -eq 0 ]
do
cat << EOF
----------------------------------------
|****Please Enter Your Choice:[0-3]****|
----------------------------------------
(1) Start $SERVER2 Service
(2) Stop $SERVER2 Service
(3) ReStart $SERVER2 Service
(0) Back
EOF
read -p "Please enter your Choice[0-3]: " input2
case $input2 in
1)
echo -e "\n>$DATE Start $SERVER2"/log.txt
$SERVER2_START 2/log.txt
if [ $"Start $SERVER2......................................................[OK]"
else
echo "Start $SERVER2......................................................[FAILED]"
fi
sleep 5
clear
;;
2)
echo -e "\n>$DATE Stop $SERVER2"/log.txt
$SERVER2_STOP 2/log.txt
if [ $"Stop $SERVER2.......................................................[OK]"
else
echo "Stop $SERVER2.......................................................[FAILED]"
fi
sleep 5
clear
;;
3)
echo -e "\n>$DATE ReStart $SERVER2"/log.txt
$SERVER2_RESTART 2/log.txt
if [ $"Restart $SERVER2....................................................[OK]"
else
echo "Restart $SERVER2....................................................[FAILED]"
fi
sleep 5
clear
;;
0)
clear
break
;;
*) echo "----------------------------------"
echo "| Warning!!! |"
echo "| Please Enter Right Choice! |"
echo "----------------------------------"
for i in `seq -w 10 -1 1`
do
echo -ne "\b\b$i";
sleep 1;
done
clear
;;
esac
done
;;
#网络服务
3)
clear
while [ "$flag" -eq 0 ]
do
cat << EOF
----------------------------------------
|****Please Enter Your Choice:[0-3]****|
----------------------------------------
(1) ReStart NETWORK Service
(2) Configure NETWORK Service
(0) Back
EOF
read -p "Please enter your Choice[0-3]: " input3
case $input3 in
1)
echo -e "\n>$DATE ReStart Network"/log.txt
/etc/init.d/network restart 2/log.txt
if [ $"Restart Network.....................................................[OK]"
else
echo "Restart Network.....................................................[FAILED]"
fi
sleep 5
clear
;;
2)
clear
setup
clear
;;
0)
clear
break
;;
*) echo "----------------------------------"
echo "| Warning!!! |"
echo "| Please Enter Right Choice! |"
echo "----------------------------------"
for i in `seq -w 10 -1 1`
do
echo -ne "\b\b$i";
sleep 1;
done
clear
;;
esac
done
;;
4)
clear
while [ "$flag" -eq 0 ]
do
cat << EOF
----------------------------------------
|****Please Enter Your Choice:[0-3]****|
----------------------------------------
(1) Change ROOT Passwd
(2) Change Samba Passwd
(0) Back
EOF
read -p "Please enter your Choice[0-3]: " input5
case $input5 in
1)
echo -e "\n>$DATE Change System Administertor Root Passwd\n"/log.txt
passwd root 2/log.txt
if [ $"Change ROOT Passwd.....................................................[OK]"
else
echo "Change ROOT Passwd.....................................................[FAILED]"
fi
sleep 5
clear
;;
2)
echo -e "\n>$DATE Change Samba Passwd"/log.txt
smbpasswd -a tdoa 2/log.txt
if [ $"Change Samba Passwd.....................................................[OK]"
else
echo "Change Samba Passwd.....................................................[FAILED]"
fi
sleep 5
clear
;;
0)
clear
break
;;
*) echo "----------------------------------"
echo "| Warning!!! |"
echo "| Please Enter Right Choice! |"
echo "----------------------------------"
sleep 8
clear
;;
esac
done
;;
5)
clear
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "|"
less /log.txt
echo "|"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
;;
0)
clear
exit 0
;;
*) echo "----------------------------------"
echo "| Warning!!! |"
echo "| Please Enter Right Choice! |"
echo "----------------------------------"
for i in `seq -w 10 -1 1`
do
echo -ne "\b\b$i";
sleep 1;
done
clear
;;
esac
done
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]