diff --git a/cmd/dwelling-upload/main.go b/cmd/dwelling-upload/main.go index cfa90f9..04fac62 100644 --- a/cmd/dwelling-upload/main.go +++ b/cmd/dwelling-upload/main.go @@ -93,17 +93,16 @@ func main() { doneSignal := make(chan os.Signal, 1) signal.Notify(doneSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) - closeSignal := make(chan bool, 1) + logReopenSignal := make(chan os.Signal, 1) + signal.Notify(logReopenSignal, syscall.SIGHUP) go func() { for { select { - case <-doneSignal: - if err := srv.Stop(); err != nil { - logErr.Fatalln("failed to properly shutdown a server:", err) - } - - closeSignal <- true + case <-logReopenSignal: + logErr.Reopen(config.Log.Error) + logUpload.Reopen(config.Log.Upload) + logDownload.Reopen(config.Log.Download) case <-uploadDirNotify: sz, err := utils.DirectorySize(config.Uploads.Directory) if err != nil { @@ -117,5 +116,9 @@ func main() { } }() - <-closeSignal + <-doneSignal + + if err := srv.Stop(); err != nil { + logErr.Fatalln("failed to properly shutdown a server:", err) + } }