Help regarding systemd service that restarts itself
I have a jar endpoint.jar
running as a systemd service. Another jar upgrade.jar
is called by endpoint.jar
when the service needs to be upgraded. Now, upgrade.jar
runs a stopall.sh
script which executes sudo sytemctl stop endpoint.service
. Now, after call the stopall.sh
script, upgrade jar is supposed to do some other stuff but as soon as endpoint.jar
is stopped, upgrade.jar
also stops running. So far, I have tried nohup
, setsid
, systemd-run
but it suffers the same problem; everything stops as soon as endpoint.jar
is stopped. All the processes spawned by endpoint.jar end up as a part of the same cgroup /system.slice/endpoint.service
and are terminated as soon as sudo systemctl stop endpoint.service
is called. I have run out of options since no google, linux stackexchange, stack overflow, chatgpt, gemini, deepseek answers have been helpful to me.