My application uses Spring Boot 2.3.1.RELEASE, it is an executable jar that uses an Embedded Tomcat and is listening on port 10605. I deployed on CentOS Linux release 7.6.1810 (Core).
I took the following steps:
- SPEEDYF.service creation
[Unit]
Description=SPEEDYF
After=syslog.target
[Service]
User=root
ExecStart=/usr/local/bin/SPEEDYF/SPEEDYF.sh
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
- creation of executable SPEEDYF.sh
#! / Bin / bash
sudo java -jar -Dspring.profiles.active = prod /usr/local/bin/SPEEDYF/SPEEDYF-0.0.1-SNAPSHOT.jar
For the first time the command: systemctl enable SPEEDYF.service The start works correctly: systemctl start SPEEDYF.service
While the stop does not work properly: systemctl stop SPEEDYF.service. That is, if I run the systemctl status SPEEDYF.service command I have the following output:
● SPEEDYF.service - SPEEDYF Loaded: loaded (/etc/systemd/system/SPEEDYF.service; enabled; vendor preset: disabled) Active: inactive (dead) .........
But the application is still running, that is, it writes the application logs and then verifying with the command:
lsof -i -P -n | grep LISTEN
the TCP port 10605 results in LISTEN.
The commands are executed with the root user. I don't understand what I can do to make the stop work properly.
Thanks in advance