linux 下命令菜单

#!/bin/bash
#menu.sh
 
menu(){
source ~/.bashrc
echo "================================="
echo "Please enter your choise:"
echo "(0) Kill all java"
echo "(1) Start all tomcat"
echo "(2) Start web"
echo "(3) Start crm"
echo "(4) Restart mysql"
echo "(5) Restart nginx"
echo "(6) Check java...."

echo "(9) Exit Menu"
echo "================================"
read input
if [ $input != "9" -a  $input != "0" -a $input != "1" -a $input != "2" -a $input != "3" -a $input != "4" -a $input != "5" -a $input != "6"  ]
then
  menu
fi
 
case $input in
    0)
    echo Are you sure kill all java ?
    sleep 1
    read -s -n1 -p "Are you sure?(y/n)?:.... "
    if [ $REPLY == "y" ]
    then  
      echo kill all java ===OK==
      killall java

    fi
    menu;;
    1)
    echo Are you sure start all tomcat?
    sleep 1
    read -s -n1 -p "Are you sure(y/n)? ... "
    if [ $REPLY == "y" ]
    then
        echo start all tomcat ==OK===
        /data/web/zxweb/apache-tomcat-7.0.75/bin/startup.sh
        sleep 5
        /data/web/crm/tomcat/apache-tomcat-7.0.82/bin/startup.sh
        
        
    fi
    menu;;
    2)
    echo Start web
    sleep 1
    read -s -n1 -p "Are you sure(y/n)? ... "
    if [ $REPLY == "y" ]
    then
        echo start web  ==OK===
        /data/web/zxweb/apache-tomcat-7.0.75/bin/startup.sh
    fi
    menu;;
    3)
    echo Start crm
    sleep 1
    read -s -n1 -p "Are you sure(y/n)? ... "
    if [ $REPLY == "y" ]
    then
        echo start crm ==OK===
        /data/web/crm/tomcat/apache-tomcat-7.0.82/bin/startup.sh
    fi
    menu;;
    4)
    echo Restart mysql
    sleep 1
     read -s -n1 -p "Are you sure(y/n)? ... "
    if [ $REPLY == "y" ]
    then
        echo start mysql ==OK===
        systemctl restart mysqld.service
    fi
    menu;;
    5)
    echo restart nginx
    sleep 1
    read -s -n1 -p "Are you sure(y/n)? ... "
    if [ $REPLY == "y" ]
    then
        echo start nginx ==OK===
        systemctl restart nginx
    fi
    menu;;
    6)
    echo check java .......
    sleep 1
    ps aux|grep java

    menu;;
    9)
    exit;;
esac
}
menu

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值