美文网首页
Linux 开启java守护进程

Linux 开启java守护进程

作者: 夜空最亮的9星 | 来源:发表于2023-12-28 15:04 被阅读0次
    
    #!/bin/bash
    
    cat >/tmp/blbs.service <<EOL
    [Unit]
    Description=Open Java blbs Service
    After=network.target
    
    [Service]
    Type=simple
    User=root
    Restart=on-failure
    RestartSec=5s
    ExecStart=/opt/jdk1.8.0_281/bin/java -jar /app/bl_jar/ruoyi-blbs.jar  --spring.profiles.active=node1
    ExecStop=/usr/bin/kill -15 $MAINPID
    WorkingDirectory=/app/bl_jar
    
    [Install]
    WantedBy=multi-user.target
    EOL
    
    sudo mv /tmp/blbs.service /lib/systemd/system/blbs.service
    
    echo "[*] Starting blbs systemd service"
    sudo systemctl daemon-reload
    sudo systemctl enable blbs.service
    sudo systemctl is-enabled blbs.service
    sudo systemctl restart blbs.service
    #sudo systemctl start blbs.service
    sudo systemctl status blbs.service
    

    相关文章

      网友评论

          本文标题:Linux 开启java守护进程

          本文链接:https://www.haomeiwen.com/subject/zmzdndtx.html