if ps aux | grep bt | grep -v grep > /dev/null ; then echo"宝塔面板已安装" else echo"宝塔面板未安装,马上执行安装!" # 检测是什么系统,安装宝塔面板 if [[ $(uname -s) == "Linux" ]]; then if [[ -f /etc/lsb-release && $(grep DISTRIB_ID= /etc/lsb-release | cut -d= -f2) == "Ubuntu" ]]; then echo"是Ubuntu,安装Ubuntu的宝塔面板" system_type=1 #wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh elif [[ -f /etc/os-release && $(grep '^ID=' /etc/os-release | cut -d= -f2 | sed 's/"//g') == "deepin" ]]; then echo"是Deepin,安装Deepin的宝塔面板" system_type=2 #wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh elif [[ -f /etc/redhat-release && $(cat /etc/redhat-release | awk '{print $1}') == "CentOS" ]]; then echo"是centos,安装Centos的宝塔面板" #yum install -y wget && wget -O install.sh https://download.bt.cn/install/install_6.0.sh && sh install.sh system_type=3 fi fi fi
# 检测是否安装了virbox用户工具 if ps aux | grep senseshield | grep -v grep > /dev/null ; then echo"用户工具已安装" else echo"用户工具未安装" if [[ $(uname -s) == "Linux" ]]; then if [[ -f /etc/lsb-release && $(grep DISTRIB_ID= /etc/lsb-release | cut -d= -f2) == "Ubuntu" ]]; then system_type=1 elif [[ -f /etc/os-release && $(grep '^ID=' /etc/os-release | cut -d= -f2 | sed 's/"//g') == "deepin" ]]; then system_type=2 elif [[ -f /etc/redhat-release && $(cat /etc/redhat-release | awk '{print $1}') == "CentOS" ]]; then system_type=3 fi fi fi
# 安装virbox用户工具 if [[ $system_type == "1" || $system_type == "2" ]]; then echo"安装virbox用户工具---Ubuntu/Deepin" #dpkg -i senseshield-2.5.0.60698-i386.deb elif [[ $system_type == "3" ]]; then echo"安装virbox用户工具---Centos" #rpm -ivh senseshield-2.5.0.60698-1.x86_64.rpm fi
# 检查服务是否启动 services=("nginx""mysql""redis""senseshield") started_services=0 # 记录已启动的服务数量 for service in"${services[@]}" do if pgrep "$service" >/dev/null then echo"$service 服务已经启动" started_services=$((started_services+1)) else echo"$service 服务未启动" fi done
if [[ $started_services -eq ${#services[@]} ]]; then echo"依赖服务全部已启动" # 服务全部启动后,进行用户工具的激活授权码操作 while ! [[ $license_key =~ ^[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}$ ]]; do echo"请输入授权码(格式:XXXX-XXXX-XXXX-XXXX):" # 读取用户输入,并校验 read license_key if ! [[ $license_key =~ ^[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}$ ]]; then echo"授权码格式不正确" fi done echo"激活完毕,即将运行……" echo"查看目录" ls if [ -d jdk-17.0.9 ]; then echo"jdk-17.0.9 目录存在" echo"运行jar包……" ./start.sh else echo"jdk-17.0.9 目录不存在" echo"解压jdk……" ./jieya.sh ./start.sh fi fi