tomcat 自动启动

为了让TOMCAT在开机时自动启动, 你必须添加一个脚本, 实现自动启动关闭

 

sudo vi /etc/init.d/tomcat

 

加入以下内容

 

    # Tomcat auto-start
    #
    # description: Auto-starts tomcat
    # processname: tomcat
    # pidfile: /var/run/tomcat.pid

    export JAVA_HOME=/usr/lib/jvm/java-6-sun

    case $1 in
    start)
            sh /usr/local/tomcat/bin/startup.sh
            ;;
    stop)  
            sh /usr/local/tomcat/bin/shutdown.sh
            ;;
    restart)
            sh /usr/local/tomcat/bin/shutdown.sh
            sh /usr/local/tomcat/bin/startup.sh
            ;;
    esac   
    exit 0

 改权限

sudo chmod 755 /etc/init.d/tomcat

 创建链接文件

 

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

 

你可能感兴趣的:(tomcat)