X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-check%2Fmain.go;h=b2a931c977f665bdb8a5d90ab2901cdca6b98f98;hb=aedcfb28a36dd95e47ec093e2c3048146baf163e;hp=6575ded385ef07b06ef5d78aa634b5b9482c6f02;hpb=d647ff64b0d63df265ab903ff01fc3dc61ee6ee5;p=nncp.git diff --git a/src/cmd/nncp-check/main.go b/src/cmd/nncp-check/main.go index 6575ded..b2a931c 100644 --- a/src/cmd/nncp-check/main.go +++ b/src/cmd/nncp-check/main.go @@ -24,6 +24,7 @@ import ( "log" "os" "path/filepath" + "time" "go.cypherpunks.ru/nncp/v7" ) @@ -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) }