From 6965075825dc4c7aa38fad27e0c0f0c8b44c0ac4 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 13 Jun 2018 02:00:53 +0300 Subject: [PATCH] core: instance restart (reload) event (#2178) --- plugins.go | 7 ++++--- sigtrap_posix.go | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins.go b/plugins.go index 5d36f55e2..3d51d1fc1 100644 --- a/plugins.go +++ b/plugins.go @@ -263,9 +263,10 @@ type EventName string // Define names for the various events const ( StartupEvent EventName = "startup" - ShutdownEvent EventName = "shutdown" - CertRenewEvent EventName = "certrenew" - InstanceStartupEvent EventName = "instancestartup" + ShutdownEvent = "shutdown" + CertRenewEvent = "certrenew" + InstanceStartupEvent = "instancestartup" + InstanceRestartEvent = "instancerestart" ) // EventHook is a type which holds information about a startup hook plugin. diff --git a/sigtrap_posix.go b/sigtrap_posix.go index 16c8e8616..9d0bab9cb 100644 --- a/sigtrap_posix.go +++ b/sigtrap_posix.go @@ -90,6 +90,7 @@ func trapSignalsPosix() { purgeEventHooks() // Kick off the restart; our work is done + EmitEvent(InstanceRestartEvent, nil) _, err = inst.Restart(caddyfileToUse) if err != nil { restoreEventHooks(oldEventHooks)