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".