We have a custom application that messes with a LOT of 3rd party resources. When terminating, we need to gracefully "give up the lease" so to speak.
The app itself is written in .NET Core (and targets true multiplatform run-ability). We use Systemd's ExecStop
mechanism in Linux to call our custom helper script (myapp cli shutdown
).
That helper script exists in Windows too, but we're unsure how to actually tie it in with Windows' service management. We use NSSM to keep the service itself up continuously, but are open to options if this can be achieved.
I tried googling / searching StackExchange about a custom stop command on Windows, but have come up empty.
Does anyone know how we can pull this off?