Add shutdown handler (#7787)
This commit is contained in:
parent
2748c53a6a
commit
1df1a6ea81
1 changed files with 4 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue