func trapSignalsPosix() {
	go func() {
		sigchan := make(chan os.Signal, 1)
		signal.Notify(sigchan, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGUSR1, syscall.SIGUSR2)
		for sig := range sigchan {
			switch sig {
			case syscall.SIGQUIT:
				Log().Info("quitting process immediately", zap.String("signal", "SIGQUIT"))
				certmagic.CleanUpOwnLocks(Log())  
				os.Exit(ExitCodeForceQuit)
			case syscall.SIGTERM:
				Log().Info("shutting down apps, then terminating", zap.String("signal", "SIGTERM"))
				exitProcessFromSignal("SIGTERM")
			case syscall.SIGUSR1:
				Log().Info("not implemented", zap.String("signal", "SIGUSR1"))
			case syscall.SIGUSR2:
				Log().Info("not implemented", zap.String("signal", "SIGUSR2"))
			case syscall.SIGHUP:
				Log().Info("not implemented", zap.String("signal", "SIGHUP"))
			}
		}
	}()
}
trapSignalsPosix captures POSIX-only signals.
package caddy
import (
	"os"
	"os/signal"
	"syscall"
	"github.com/caddyserver/certmagic"
	"go.uber.org/zap"
)