How detect shutdown of a dedicated server application?

The only thing that comes to mind is a crutch solution such as a sub process that checks if the server process is running …
Is there a more adequate solution?