diff --git a/home/clients.go b/home/clients.go index 1c2b795b..81e7832d 100644 --- a/home/clients.go +++ b/home/clients.go @@ -107,6 +107,12 @@ func (clients *clientsContainer) Init(objects []clientObject, dhcpServer *dhcpd. } } +// Reload - reload auto-clients +func (clients *clientsContainer) Reload() { + clients.addFromHostsFile() + clients.addFromSystemARP() +} + type clientObject struct { Name string `yaml:"name"` Tags []string `yaml:"tags"` @@ -194,8 +200,7 @@ func (clients *clientsContainer) WriteDiskConfig(objects *[]clientObject) { func (clients *clientsContainer) periodicUpdate() { for { - clients.addFromHostsFile() - clients.addFromSystemARP() + clients.Reload() time.Sleep(clientsUpdatePeriod) } } diff --git a/home/home.go b/home/home.go index 760d48ed..299653c4 100644 --- a/home/home.go +++ b/home/home.go @@ -116,10 +116,19 @@ func Main(version string, channel string, armVer string) { Context.appSignalChannel = make(chan os.Signal) signal.Notify(Context.appSignalChannel, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT) go func() { - <-Context.appSignalChannel - cleanup() - cleanupAlways() - os.Exit(0) + for { + sig := <-Context.appSignalChannel + log.Info("Received signal '%s'", sig) + switch sig { + case syscall.SIGHUP: + Context.clients.Reload() + + default: + cleanup() + cleanupAlways() + os.Exit(0) + } + } }() // run the protection