Article 6MAGK [SOLVED] systemctl kill pgm to fast

[SOLVED] systemctl kill pgm to fast

by
cormanstnl
from LinuxQuestions.org on (#6MAGK)
Hi,

I have a java pgm running on a server.
I made a bash script for start the java and an other to stop the programme.

And a call these scripts from a systemd script.

Code:[Unit]
Description=PONTBASCULEDP
After=mysqld.service

[Service]
Type=oneshot
ExecStart=/opt/middleware/pontbasculedp/start_robot_pontbasculedp.sh
ExecStop=/opt/middleware/pontbasculedp/stop_robot_pontbasculedp.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.targetThe command for ending the program consist to put a value "STOP" on a table and a thread check if the "STOP" is set and if yes, end thread and exist the application.

But when the call of stop_robot_pontbasculedp.sh is executed by systemd, I see that the flag for stopping the pgm is set but systemctl send the SGIKILL or SIFTERM to fast and the process is killed and not ended correctly.

So how to add a wait or somethings like this for ask systemd to wait the end of the program ?
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments