diff --git a/caddy/caddymain/run.go b/caddy/caddymain/run.go index 369c7a9b4..33151003c 100644 --- a/caddy/caddymain/run.go +++ b/caddy/caddymain/run.go @@ -83,6 +83,7 @@ func Run() { caddy.AppName = appName caddy.AppVersion = module.Version + caddy.OnProcessExit = append(caddy.OnProcessExit, certmagic.CleanUpOwnLocks) certmagic.UserAgent = appName + "/" + cleanModVersion // Set up process log before anything bad happens diff --git a/sigtrap.go b/sigtrap.go index 7570729d4..236585ea3 100644 --- a/sigtrap.go +++ b/sigtrap.go @@ -21,7 +21,6 @@ import ( "sync" "github.com/caddyserver/caddy/telemetry" - "github.com/mholt/certmagic" ) // TrapSignals create signal handlers for all applicable signals for this @@ -50,7 +49,6 @@ func trapSignalsCrossPlatform() { for _, f := range OnProcessExit { f() // important cleanup actions only } - certmagic.CleanUpOwnLocks() os.Exit(2) } @@ -65,7 +63,6 @@ func trapSignalsCrossPlatform() { } go func() { - certmagic.CleanUpOwnLocks() os.Exit(executeShutdownCallbacks("SIGINT")) }() } diff --git a/sigtrap_posix.go b/sigtrap_posix.go index f19f05c17..607861846 100644 --- a/sigtrap_posix.go +++ b/sigtrap_posix.go @@ -23,7 +23,6 @@ import ( "syscall" "github.com/caddyserver/caddy/telemetry" - "github.com/mholt/certmagic" ) // trapSignalsPosix captures POSIX-only signals. @@ -39,7 +38,6 @@ func trapSignalsPosix() { for _, f := range OnProcessExit { f() // only perform important cleanup actions } - certmagic.CleanUpOwnLocks() os.Exit(0) case syscall.SIGTERM: @@ -57,7 +55,6 @@ func trapSignalsPosix() { telemetry.AppendUnique("sigtrap", "SIGTERM") go telemetry.StopEmitting() // won't finish in time, but that's OK - just don't block - certmagic.CleanUpOwnLocks() os.Exit(exitCode) case syscall.SIGUSR1: