Add shutdown handler (#7787)

This commit is contained in:
andig 2023-05-03 08:10:57 +02:00 • committed by GitHub
parent 2748c53a6a
commit 1df1a6ea81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -250,6 +250,10 @@ func runRoot(cmd *cobra.Command, args []string) {
// show main ui
if err == nil {
httpd.RegisterSiteHandlers(site, cache)
httpd.RegisterShutdownHandler(func() {
log.FATAL.Println("evcc was stopped by user. OS should restart the service. Or restart manually.")
once.Do(func() { close(stopC) }) // signal loop to end
})
// set channels
site.DumpConfig()