范例:
[root@centos8 ~]#cat install_tomcat_for_centos.sh #!/bin/bash # #******************************************************************** #Author: wangxiaochun #QQ: 29308620 #Date: 2020-02-09 #FileName: install_tomcat_for_centos.sh #URL: http://www.wangxiaochun.com #Description: The test script #Copyright (C): 2020 All rights reserved #******************************************************************** . /etc/init.d/functions DIR=pwd JDK_FILE="jdk-8u241-linux-x64.tar.gz" TOMCAT_FILE="apache-tomcat-8.5.50.tar.gz" JDK_DIR="/usr/local" TOMCAT_DIR="/usr/local" install_jdk(){ if ! [ -f "DIR/JDK_FILE" ];then action "JDK_FILE 文件不存在" false exit; elif [ -dJDK_DIR/jdk ];then action "JDK 已经安装" false exit else [ -d "JDK_DIR" ] || mkdir -pvJDK_DIR fi tar xvf DIR/JDK_FILE -C JDK_DIR cdJDK_DIR && ln -s jdk1.8.* jdk cat > /etc/profile.d/jdk.sh </etc/profile.d/tomcat.sh id tomcat &> /dev/null || useradd -r -s /sbin/nologin tomcat cat>TOMCAT_DIR/tomcat/conf/tomcat.conf < /lib/systemd/system/tomcat.service < /dev/null && action "TOMCAT 安装完成" || { action "TOMCAT 安装失败" false ; exit; } } install_jdk install_tomcat
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)