mirror of https://bitbucket.org/ausocean/av.git
Merged in netsend-fail (pull request #27)
cmd/revid-cli: handle failure to start netsender
This commit is contained in:
commit
709de3f119
|
@ -31,6 +31,7 @@ import (
|
|||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -130,7 +131,7 @@ func main() {
|
|||
}
|
||||
|
||||
// Do we want a netsender session
|
||||
netSenderFlagPtr := flag.Bool("NetSender", false, "Are we checking vars through netsender?")
|
||||
useNetsender := flag.Bool("NetSender", false, "Are we checking vars through netsender?")
|
||||
// User might also want to define how long revid runs for
|
||||
runDurationPtr := flag.Duration("runDuration", defaultRunDuration, "How long do you want revid to run for?")
|
||||
|
||||
|
@ -249,12 +250,17 @@ func main() {
|
|||
|
||||
var ns netsender.Netsender
|
||||
var vs int
|
||||
if *netSenderFlagPtr {
|
||||
if *useNetsender {
|
||||
// initialize NetSender and use NetSender's logger
|
||||
config.Logger = netsender.GetLogger()
|
||||
|
||||
// FIXME(kortschak): Handle this error appropriately.
|
||||
ns, _ = netsender.NewNetsender(false, revidReportActions)
|
||||
var err error
|
||||
ns, err = netsender.NewNetsender(false, revidReportActions)
|
||||
if err != nil {
|
||||
l := smartlogger.New(loggerVerbosity, smartlogger.File, "/var/log/netsender/")
|
||||
l.Log(progName, "Error", err.Error()) // TODO(kortschak): Make this "Fatal" when that exists.
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
vs = ns.GetVarSum()
|
||||
} else {
|
||||
|
@ -267,7 +273,7 @@ func main() {
|
|||
paused := false
|
||||
|
||||
// loop in NetSender mode
|
||||
for *netSenderFlagPtr {
|
||||
for *useNetsender {
|
||||
if err := sendTo(ns); err != nil {
|
||||
config.Logger.Log(progName, "Error", err.Error())
|
||||
time.Sleep(netSendRetryTime)
|
||||
|
|
Loading…
Reference in New Issue