V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
bfqymmt
V2EX  ›  Linux

关于服务开机启动的问题

  •  
  •   bfqymmt · May 8, 2020 · 3954 views
    This topic created in 2186 days ago, the information mentioned may be changed or developed.

    OS:ubuntu 16 查了很多资料,重启后,还是不能开机启动。

    /etc/init.d/tomcat
    chmod +x /etc/init.d/tomcat
    update-rc.d tomcat defaults
    

    能正常使用 service tomcat start|stop

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides:             tomcat
    # Required-Start:       $remote_fs $network
    # Required-Stop:        $remote_fs $network
    # Default-Start:        2 3 4 5
    # Default-Stop:         0 1 6
    # Short Description:    the tomcat Java Application Server
    ### END INIT INFO
    
    export JAVA_HOME=/opt/jdk1.8.0_231
    export JRE_HOME=$JAVA_HOME/jre
    export PATH=$PATH:$JAVA_HOME/bin
    export CLASSPATH=.
    export CATALINA_HOME=/opt/tomcat/
    
    case "$1" in
    start)
            ${CATALINA_HOME}/bin/startup.sh
            echo 'tomcat start success'
            exit 0
            ;;
    stop)
            ${CATALINA_HOME}/bin/shutdown.sh
             echo 'tomcat stop success'
    略
    

    Snipaste_2020-05-08_17-09-02.png

    7 replies    2020-05-09 08:10:31 +08:00
    julyclyde
        1
    julyclyde  
       May 8, 2020
    ubuntu 16 用的是 systemd
    你咋查的?
    axeprpr1
        3
    axeprpr1  
       May 8, 2020
    crontab -e
    @reboot a.sh
    yyyb
        4
    yyyb  
       May 8, 2020
    用 systemctl
    jinliming2
        5
    jinliming2  
       May 8, 2020
    systemctl enable tomcat 设置开机启动啊

    systemctl start ...
    systemctl stop ...
    systemctl status ...
    systemctl restart ...
    systemctl reload ...

    service 命令好早前就不用了
    mgrddsj
        6
    mgrddsj  
       May 9, 2020
    用 systemctl 来管理,最好用 Google + 英文搜索,中文的 Linux 相关的知识很多都已过期。
    搜索关键词:systemctl autostart
    CheekiBreeki
        7
    CheekiBreeki  
       May 9, 2020 via Android
    systemctl
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2401 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 63ms · UTC 10:16 · PVG 18:16 · LAX 03:16 · JFK 06:16
    ♥ Do have faith in what you're doing.