0

I have created a service like below:-

Description=Java Service

[Service]
User=nobody
# The configuration file application.properties should be here:
WorkingDirectory=/home/ubuntu/pear
ExecStart=/usr/bin/java -jar springbootdemo-0.0.1-SNAPSHOT.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

The java application is running on port 9090 and sometimes the process gets killed due to some issue but when i check the status of service it shows as "running".

  • Is the process actually gone after it is "killed", or does it just not listen anymore? Also, could you append the output of `systemctl status ` (while the process is in a "killed" state) to the original question? – Tim Schumacher Jan 06 '20 at 11:26
  • Process is just killed...when i restart the service it got back again....i can share the output once it's reproduced again – rohit singh Jan 06 '20 at 11:32
  • Please check whether the process is _actually_ gone from the Task Manager/`top`/`htop` as well, instead of it just not accepting requests anymore. systemd rarely just says "Process is still running" while it actually isn't. – Tim Schumacher Jan 06 '20 at 11:34
  • I actually checked the process using **sudo netstat -plnt | grep ':9090'** and it shows empty. – rohit singh Jan 06 '20 at 12:02
  • Yeah, but that would also show empty if the process is still running, but it released the port gracefully. Please still check in your preferred task manager whether the process is indeed not running at all. – Tim Schumacher Jan 06 '20 at 12:05
  • Ok....I will check that once the issue is reproduced again. Thanks @TimSchumacher – rohit singh Jan 06 '20 at 12:05
  • @TimSchumacher The issue happened again and I checked the task manager and process is not running. – rohit singh Jan 07 '20 at 05:37

0 Answers0