0

I am converting our service startup script from SysV to systemd.

Our "service" is a java server running in Netty.

To start the service, in the unit file I have something like:

[Service]
SyslogIdentifier=%N
Type=simple
ExecStart=/usr/bin/java -jar ....jar

I don't think the exact command is relevant here. It starts just as I expect, and everything runs fine.

To shut down the service we have special URL. So to stop the service, in the unit file I have:

ExecStop=/usr/bin/wget -t3 -T5 -q -O- http://localhost:7090/shutdown
TimeoutStopSec=10
Restart=on-failure

Whenever I call systemctl stop server I always end up with:

● server.service - some Control System server
   Loaded: loaded (/etc/systemd/system/server.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2019-03-24 00:54:19 UTC; 3s ago
  Process: 8756 ExecStop=/usr/bin/wget -t3 -T5 -q -O- http://localhost:7090/shutdown (code=exited, status=0/SUCCESS)
  Process: 8597 ExecStart=/usr/bin/java -jar ....jar (code=exited, status=0/SUCCESS)

The service stops. But why do I get failed (Result: exit-code)?

Edit: Running journalctl -u server, I see:

Mar 24 19:10:10 hive systemd[1]: Stopping some Control System server...
Mar 24 19:10:10 hive server[13731]: SHUTDOWN STARTING. END IN 15 SEC
Mar 24 19:10:10 hive systemd[1]: server.service: Main process exited, code=exited, status=143/n/a
Mar 24 19:10:10 hive systemd[1]: server.service: Failed with result 'exit-code'.
Mar 24 19:10:10 hive systemd[1]: Stopped some Control System server.
  • 1
    Did you find any logging in systemd journal? Command journalctl -u abc.service – Biswapriyo Mar 24 at 4:22
0

The question is essentially answered on serverfault.

In summary:

Exit code 143 means that the program received a SIGTERM signal to instruct it to exit, but it did not handle the signal properly.

[This can be suppressed] by adding the exit code into the unit file as a "success" exit status:

[Service]
SuccessExitStatus=143

Another answer at the link above adds more detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.