} } }

    Ubuntu下设置Tomcat自启动

    添加时间:2013-6-20 点击量:

    1. cd /etc/init.d


    2. sudo vi tomcat6


    参加以下内容:



    #!/bin/sh
    

    ### BEGIN INIT INFO
    Provides: tomcat
    # Required-Start: ¥local_fs ¥remote_fs ¥network ¥syslog
    # Required-Stop: ¥local_fs ¥remote_fs ¥network ¥syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    Short-Description: starts the tomcat web server
    # Description: starts tomcat using start-stop-daemon
    ### END INIT INFO

    #tomcat auto-start

    export JAVA_HOME
    =/usr/lib/jvm/jdk1.7.0_21
    export CATALINA_HOME
    =/home/ubuntu/tomcat6

    case
    ¥1 in
    start
    sh
    /home/ubuntu/tomcat6/bin/startup.sh
    ;;

    stop

    sh
    /home/ubuntu/tomcat6/bin/shutdown.sh
    ;;

    restart

    sh
    /home/ubuntu/tomcat6/bin/shutdown.sh
    sh
    /home/ubuntu/tomcat6/bin/startup.sh
    ;;

    echo Usage:tomcat6 start|stop|restart
    ;;
    esac
    exit 0


    3. 设置为可履行:sudo chmod +x tomcat6


    4. 参加自启动任务:sudo -rc.d tomcat6 defaults

    容易发怒的意思就是: 别人做了蠢事, 然后我们代替他们, 表现出笨蛋的样子。—— 蔡康永
    分享到: