mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-04 21:47:40 +03:00
Report "reloading" state to systemd when running reload callbacks
This commit is contained in:
parent
ea40a8fbc5
commit
24a580a338
3 changed files with 10 additions and 4 deletions
|
@ -25,10 +25,14 @@ func handleSignals() os.Signal {
|
||||||
switch s := <-sig; s {
|
switch s := <-sig; s {
|
||||||
case syscall.SIGUSR1:
|
case syscall.SIGUSR1:
|
||||||
log.Printf("signal received (%s), rotating logs", s.String())
|
log.Printf("signal received (%s), rotating logs", s.String())
|
||||||
|
systemdStatus(SDReloading, "Reopening logs...")
|
||||||
hooks.RunHooks(hooks.EventLogRotate)
|
hooks.RunHooks(hooks.EventLogRotate)
|
||||||
|
systemdStatus(SDReady, "Listening for incoming connections...")
|
||||||
case syscall.SIGUSR2:
|
case syscall.SIGUSR2:
|
||||||
log.Printf("signal received (%s), reloading state", s.String())
|
log.Printf("signal received (%s), reloading state", s.String())
|
||||||
|
systemdStatus(SDReloading, "Reloading state...")
|
||||||
hooks.RunHooks(hooks.EventReload)
|
hooks.RunHooks(hooks.EventReload)
|
||||||
|
systemdStatus(SDReady, "Listening for incoming connections...")
|
||||||
default:
|
default:
|
||||||
go func() {
|
go func() {
|
||||||
s := handleSignals()
|
s := handleSignals()
|
||||||
|
|
|
@ -17,8 +17,9 @@ import (
|
||||||
type SDStatus string
|
type SDStatus string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SDReady = "READY=1"
|
SDReady = "READY=1"
|
||||||
SDStopping = "STOPPING=1"
|
SDReloading = "RELOADING=1"
|
||||||
|
SDStopping = "STOPPING=1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -5,8 +5,9 @@ package maddy
|
||||||
type SDStatus string
|
type SDStatus string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SDReady = "READY=1"
|
SDReady = "READY=1"
|
||||||
SDStopping = "STOPPING=1"
|
SDReloading = "RELOADING=1"
|
||||||
|
SDStopping = "STOPPING=1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func systemdStatus(SDStatus, string) {}
|
func systemdStatus(SDStatus, string) {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue