[systemd-devel] Springboot and systemd, clean shutdown
Brian Reichert
reichert at numachi.com
Wed Oct 2 22:06:31 UTC 2024
On Wed, Oct 02, 2024 at 11:35:59PM +0200, Silvio Knizek wrote:
> Hi,
>
> according to https://www.springcloud.io/post/2022-02/spring-boot-graceful-shutdown/#gsc.tab=0 you can just send `SIGTERM` to the MainPID as kill signal and be happy. No need to fiddle with some `curl` command. This is the same as spring boot is doing it in kubernetes (https://docs.spring.io/spring-boot/how-to/deployment/cloud.html#howto.deployment.cloud.kubernetes.container-lifecycle).
This Springboot app doesn't have the that shutdown hook implemented.
Sending a SIGTERM yields the original behavior I wanted to avoid:
10-153-68-12:/home/webapp # env SERVER_PORT=8888 LOG_DIR=/home/webapp/log JDK_JAVA_OPTIONS=-Dlogging.config=log4j2.properties -Dloader.path=lib/ SPRING_MAIN_LAZY_INITIALIZATION=true /home/eamc-agent/jdk/bin/java -jar webapp.jar; echo $?
NOTE: Picked up JDK_JAVA_OPTIONS: -Dlogging.config=log4j2.properties
2024-10-02 17:59:03,771 main ERROR appender File has no parameter that matches element Policies
143
10-153-68-12:/home/webapp # lsof -nP -i :8888
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 22011 root 9u IPv6 2703923 0t0 TCP *:8888 (LISTEN)
10-153-68-12:/home/webapp # kill -TERM 22011
> BR
> Silvio
--
Brian Reichert <reichert at numachi.com>
BSD admin/developer at large
More information about the systemd-devel
mailing list