Shut down Job Server

We have a need to be able to shut down the running job server, for example, when the server goes into a standby mode, due to failover status changing.

I can control the startup, but if we change primary sites from one location to another, we need to be able to stop the background job server, ideally without restarting the app pool or IIS.

There are .Startup and .Shutdown methods, but those are marked as obsolete, and don’t do anything any more. does support this use case.

How can I gracefully shut down the running server(s)?

Thank you!