Debian 将 springboot 应用程序作为服务执行:找不到服务
Debian execute springboot app as service: service not found
我关注这个文档:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#deployment-initd-service
我的应用回购:
└──╼ ls -l
total 67556
-rw-r--r-- 1 root root 1842 nov. 7 15:06 application.yml
-rw-r--r-- 1 root root 69169161 nov. 12 07:50 importparcoursup.jar
┌─[root@prodsb01:/var/apps/importsup]
创建时:
ln -s /var/apps/importsup/importparcoursup.jar /etc/init.d/importparcoursup
服务启动错误:
┌─[✗]─[root@prodsb01:/var/apps/importsup]
└──╼ service importparcoursup start
Failed to start importparcoursup.service: Unit importparcoursup.service not found.
我是不是忘记了什么?
这是我尝试过的更多命令:
┌─[✗]─[root@prodsb01:/var/apps/importsup]
└──╼ /etc/init.d/importparcoursup start
-bash: /etc/init.d/importparcoursup: Permission non accordée
┌─[✗]─[root@prodsb01:/var/apps/importsup]
└──╼ sudo /etc/init.d/importparcoursup start
-bash: sudo : commande introuvable
今天再试试:
┌─[root@prodsb01:/var/apps/importsup]
└──╼ ls -l /etc/init.d/
total 92
-rwxr-xr-x 1 root root 1232 avril 7 2017 console-setup.sh
-rwxr-xr-x 1 root root 3049 mai 4 2015 cron
-rwxr-xr-x 1 root root 2813 mars 2 2018 dbus
-rwxr-xr-x 1 root root 6697 avril 18 2017 fail2ban
-rwxr-xr-x 1 root root 3809 mars 22 2017 hwclock.sh
lrwxrwxrwx 1 root root 40 nov. 12 15:34 importparcoursup -> /var/apps/importsup/importparcoursup.jar
-rwxr-xr-x 1 root root 2448 déc. 31 2016 irqbalance
-rwxr-xr-x 1 root root 1479 mai 19 2016 keyboard-setup.sh
-rwxr-xr-x 1 root root 2044 déc. 26 2016 kmod
-rwxr-xr-x 1 root root 4597 sept. 17 2016 networking
-rwxr-xr-x 1 root root 1846 juil. 25 2017 open-vm-tools
-rwxr-xr-x 1 root root 3624 févr. 23 2018 postfix
-rwxr-xr-x 1 root root 1191 nov. 22 2016 procps
-rwxr-xr-x 1 root root 4355 déc. 10 2017 rsync
-rwxr-xr-x 1 root root 2868 janv. 19 2017 rsyslog
-rwxr-xr-x 1 root root 2578 juin 20 2016 snmpd
-rwxr-xr-x 1 root root 4033 mars 1 2018 ssh
-rwxr-xr-x 1 root root 6087 juil. 6 2017 udev
-rwxr-xr-x 1 root root 1391 mai 6 2017 unattended-upgrades
-rwxr-xr-x 1 root root 2757 nov. 23 2016 x11-common
┌─[root@prodsb01:/var/apps/importsup]
└──╼ service importparcoursup start
Failed to start importparcoursup.service: Unit importparcoursup.service not found.
尝试chmod +x /var/apps/importsup/importparcoursup.jar
使文件可执行。
出于某种原因,我需要重新启动服务器。现在一切正常。
我关注这个文档:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#deployment-initd-service
我的应用回购:
└──╼ ls -l
total 67556
-rw-r--r-- 1 root root 1842 nov. 7 15:06 application.yml
-rw-r--r-- 1 root root 69169161 nov. 12 07:50 importparcoursup.jar
┌─[root@prodsb01:/var/apps/importsup]
创建时:
ln -s /var/apps/importsup/importparcoursup.jar /etc/init.d/importparcoursup
服务启动错误:
┌─[✗]─[root@prodsb01:/var/apps/importsup]
└──╼ service importparcoursup start
Failed to start importparcoursup.service: Unit importparcoursup.service not found.
我是不是忘记了什么?
这是我尝试过的更多命令:
┌─[✗]─[root@prodsb01:/var/apps/importsup]
└──╼ /etc/init.d/importparcoursup start
-bash: /etc/init.d/importparcoursup: Permission non accordée
┌─[✗]─[root@prodsb01:/var/apps/importsup]
└──╼ sudo /etc/init.d/importparcoursup start
-bash: sudo : commande introuvable
今天再试试:
┌─[root@prodsb01:/var/apps/importsup]
└──╼ ls -l /etc/init.d/
total 92
-rwxr-xr-x 1 root root 1232 avril 7 2017 console-setup.sh
-rwxr-xr-x 1 root root 3049 mai 4 2015 cron
-rwxr-xr-x 1 root root 2813 mars 2 2018 dbus
-rwxr-xr-x 1 root root 6697 avril 18 2017 fail2ban
-rwxr-xr-x 1 root root 3809 mars 22 2017 hwclock.sh
lrwxrwxrwx 1 root root 40 nov. 12 15:34 importparcoursup -> /var/apps/importsup/importparcoursup.jar
-rwxr-xr-x 1 root root 2448 déc. 31 2016 irqbalance
-rwxr-xr-x 1 root root 1479 mai 19 2016 keyboard-setup.sh
-rwxr-xr-x 1 root root 2044 déc. 26 2016 kmod
-rwxr-xr-x 1 root root 4597 sept. 17 2016 networking
-rwxr-xr-x 1 root root 1846 juil. 25 2017 open-vm-tools
-rwxr-xr-x 1 root root 3624 févr. 23 2018 postfix
-rwxr-xr-x 1 root root 1191 nov. 22 2016 procps
-rwxr-xr-x 1 root root 4355 déc. 10 2017 rsync
-rwxr-xr-x 1 root root 2868 janv. 19 2017 rsyslog
-rwxr-xr-x 1 root root 2578 juin 20 2016 snmpd
-rwxr-xr-x 1 root root 4033 mars 1 2018 ssh
-rwxr-xr-x 1 root root 6087 juil. 6 2017 udev
-rwxr-xr-x 1 root root 1391 mai 6 2017 unattended-upgrades
-rwxr-xr-x 1 root root 2757 nov. 23 2016 x11-common
┌─[root@prodsb01:/var/apps/importsup]
└──╼ service importparcoursup start
Failed to start importparcoursup.service: Unit importparcoursup.service not found.
尝试chmod +x /var/apps/importsup/importparcoursup.jar
使文件可执行。
出于某种原因,我需要重新启动服务器。现在一切正常。