I have a spring-boot rest sever that is started using an init.d script that is called by systemd. Once the server is started it is considered successful by the the script. This leads to problems such as if the sever fails for a reason such as port already in use it will still be considered to have succeeded. I have come up with a solution that greps the log files last few line in a loop to make sure nothing has gone wrong and returns an error if it has but I feel this has the potential to introduce race conditions and could lead to unexpected behavior. Is there a better approach to this that could be used?