X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-check%2Fmain.go;h=721a54f4a02a12c13002d953031a3fd1e318e797;hb=b47dbfe6687569650fa544a4ecf3e4ea388390cb;hp=6575ded385ef07b06ef5d78aa634b5b9482c6f02;hpb=0fad171c0d79ad583c0faf5427e22d1d62a0a52d;p=nncp.git diff --git a/src/cmd/nncp-check/main.go b/src/cmd/nncp-check/main.go index 6575ded..721a54f 100644 --- a/src/cmd/nncp-check/main.go +++ b/src/cmd/nncp-check/main.go @@ -24,8 +24,9 @@ import ( "log" "os" "path/filepath" + "time" - "go.cypherpunks.ru/nncp/v7" + "go.cypherpunks.ru/nncp/v8" ) func usage() { @@ -38,6 +39,7 @@ func usage() { func main() { var ( nock = flag.Bool("nock", false, "Process .nock files") + cycle = flag.Uint("cycle", 0, "Repeat check after N seconds in infinite loop") cfgPath = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file") nodeRaw = flag.String("node", "", "Process only that node") spoolPath = flag.String("spool", "", "Override path to spool") @@ -83,6 +85,7 @@ func main() { } } +Cycle: isBad := false for nodeId, node := range ctx.Neigh { if nodeOnly != nil && nodeId != *nodeOnly.Id { @@ -105,6 +108,10 @@ func main() { isBad = true } } + if *cycle > 0 { + time.Sleep(time.Duration(*cycle) * time.Second) + goto Cycle + } if isBad { os.Exit(1) }