zoukankan      html  css  js  c++  java
  • centos设置tomat开机自启

    1、将Tomcat安装为service以方便管理,并配置开机自启动
    在/etc/init.d/目录下创建tomcat文件,并编辑
    touch /etc/init.d/tomcat
    vim /etc/init.d/tomcat
    输入文件内容:(注意此处JAVA_HOME的路径,根据自己实际情况修改)
    #!/bin/bash
    #chkconfig: 2345 10 90
    #description: tomcat service
    JAVA_HOME=/usr/java/jdk1.8.0_171
    PATH=$JAVA_HOME/bin:$PATH
    CATALINA_HOME=/usr/local/apache-tomcat-7.0.91
    export JAVA_HOME
    export PATH
    export CATALINA_HOME
    case $1 in
    start)
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    stop)
    sh $CATALINA_HOME/bin/shutdown.sh
    ;;
    restart)
    sh $CATALINA_HOME/bin/shutdown.sh
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    esac
    exit 0
    2、将创建的/etc/init.d/tomcat文件添加权限,设置自启动
    #增加tomcat服务控制脚本执行权限
    chmod +x /etc/init.d/tomcat
    #通过chkconfig命令将tomcat服务加入到自启动服务中
    chkconfig --add tomcat
    #开启自启动服务
    chkconfig tomcat on
    关闭chkconfig tomcat on
    #查看是否添加成功
    chkconfig --list tomcat

  • 相关阅读:
    策略模式Strategy
    flex项目
    模板方法Template Method
    timer与ScheduledExecutorService
    java两个字符串的相似度
    一个简单的webshell
    状态模式State
    Java性能优化
    责任链模式China of Responsibility
    ns2.34下mflood协议的完美移植
  • 原文地址:https://www.cnblogs.com/foreverstudy/p/13187024.html
Copyright © 2011-2022 走看看