I have a service that takes between 1 minute and 30 seconds to start or to stop. I needs to be started after network service and needs to be stopped before network service.
It works well when trigerred directly on terminal with the commands below.
# systemctl start ibmbpm
# systemctl stop ibmbpm
I have a problem when I try to shutdown the computer. The shutdown is pretty fast (about 20 seconds), so I think it's not waiting my service to finish to shutdown the computer and in the logs I can see it's having problems to connect to a local interface on 8879 port. That's the reason why I'm thinking it's not waiting my service stop before stop network.
I can see the following error on my WebSphere(IBM BPM) logs:
Caused by: com.ibm.websphere.management.exception.ConnectorException: ADMC0016E: ADMC0016E: the system cannot create a soap connector to connect to host bpmpfs01.XXXXXX.XXX at port 8879.
Here is my systemd service file
[Unit]
Description=IBM Business Process Manager 8.5.7
Requires=network.service
After=network-online.target
[Service]
Type=oneshot
ExecStart=/opt/IBM/ibmbpm start
RemainAfterExit=yes
KillMode=none
ExecStop=/opt/IBM/ibmbpm stop
TimeoutStopSec=600
[Install]
WantedBy=multi-user.target
Is there a way to make it work correctly? I really appreciate any help.
Best Answer
Try to add
Wants=network-online.target
andAfter=network.target
Have a look at: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/