OnApplicationQuit on LInux with keyboard interrupt?

Trying to do some quick cleanup of some resources before the headless linux game server quits. 90% of the time, these are shutdown with a SIGTERM or keyboard interrupt(if testing). This apparently terminates the program before OnApplicationQuit is even called.

Here’s a quick test.

protected override void OnApplicationQuit()
{
    Debug.Log("OnApplicationQuit()");
}

No output happens when doing that.

Is this intentional or a bug? Or is there a way to properly capture these types of events to shut down the server cleanly?

Ever found a solution? Facing the same problem