mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-22 03:20:41 +08:00
Co-authored-by: shenyuning <[email protected]> Co-authored-by: sxueck <[email protected]>
33 lines
566 B
Go
33 lines
566 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"github.com/hacdias/webdav/v3/lib"
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"runtime"
|
|
"syscall"
|
|
"time"
|
|
|
|
"github.com/hacdias/webdav/v3/cmd"
|
|
)
|
|
|
|
func main() {
|
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
go lib.LastRequestLogIndex(ctx)
|
|
go cmd.Execute()
|
|
|
|
sigterm := make(chan os.Signal, 1)
|
|
signal.Notify(sigterm, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
|
|
|
<-sigterm
|
|
log.Println("receive stop signal")
|
|
|
|
cancel()
|
|
// wait for other goroutines to quit
|
|
time.Sleep(2 * time.Second)
|
|
}
|