This commit is contained in:
YouROK
2020-11-06 16:49:18 +03:00
parent a1e17b1cf3
commit f92b9eebf3
11 changed files with 83 additions and 60 deletions

View File

@@ -10,7 +10,6 @@ import (
"github.com/alexflint/go-arg"
"server"
"server/settings"
"server/version"
)
@@ -45,12 +44,7 @@ func main() {
Preconfig(params.Kill)
server.Start(params.Path, params.Port)
if (params.RDB) {
settings.SetRDB()
} else {
settings.SaveSettings()
}
server.Start(params.Path, params.Port, params.RDB)
fmt.Println(server.WaitServer())
time.Sleep(time.Second * 3)
os.Exit(0)

View File

@@ -9,25 +9,29 @@ import (
"os"
"os/signal"
"syscall"
"server"
)
func Preconfig(kill bool) {
if kill {
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGSTOP,
syscall.SIGPIPE,
syscall.SIGTERM,
syscall.SIGQUIT)
go func() {
for s := range sigc {
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGSTOP,
syscall.SIGPIPE,
syscall.SIGTERM,
syscall.SIGQUIT)
go func() {
for s := range sigc {
if kill {
fmt.Println("Signal catched:", s)
fmt.Println("For stop server, close in web")
} else {
server.Stop()
}
}()
}
}
}()
//dns resover
addrs, err := net.LookupHost("www.themoviedb.org")