mirror of
https://github.com/hacdias/webdav.git
synced 2024-04-21 12:32:06 +00:00
Co-authored-by: shenyuning <shenyn@hua-cloud.com.cn> Co-authored-by: sxueck <shenyuning@ctirobot.com>
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)
|
|
}
|