Add BeforeRestart hook