演示效果:
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
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 雨林唱片《赏》新曲+精选集SACD版[ISO][2.3G]
- 罗大佑与OK男女合唱团.1995-再会吧!素兰【音乐工厂】【WAV+CUE】
- 草蜢.1993-宝贝对不起(国)【宝丽金】【WAV+CUE】
- 杨培安.2009-抒·情(EP)【擎天娱乐】【WAV+CUE】
- 周慧敏《EndlessDream》[WAV+CUE]
- 彭芳《纯色角3》2007[WAV+CUE]
- 江志丰2008-今生为你[豪记][WAV+CUE]
- 罗大佑1994《恋曲2000》音乐工厂[WAV+CUE][1G]
- 群星《一首歌一个故事》赵英俊某些作品重唱企划[FLAC分轨][1G]
- 群星《网易云英文歌曲播放量TOP100》[MP3][1G]
- 方大同.2024-梦想家TheDreamer【赋音乐】【FLAC分轨】
- 李慧珍.2007-爱死了【华谊兄弟】【WAV+CUE】
- 王大文.2019-国际太空站【环球】【FLAC分轨】
- 群星《2022超好听的十倍音质网络歌曲(163)》U盘音乐[WAV分轨][1.1G]
- 童丽《啼笑姻缘》头版限量编号24K金碟[低速原抓WAV+CUE][1.1G]