Check for "Paused" mode when starting.

This commit is contained in:
Alan Noble 2018-06-22 20:09:03 +09:30
parent 590136197b
commit c01300eef6
1 changed files with 11 additions and 7 deletions

View File

@ -242,25 +242,29 @@ func main() {
var ns netsender.Sender
var vs int
paused := false
if *useNetsender {
// initialize NetSender and use NetSender's logger
config.Logger = netsender.Logger()
var err error
err = ns.Init(nil, nil, nil)
err := ns.Init(nil, nil, nil)
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.
config.Logger.Log(progName, "Error", err.Error()) // TODO(kortschak): Make this "Fatal" when that exists.
os.Exit(1)
}
vars, _ := ns.Vars()
if vars["mode"] == "Paused" {
paused = true
}
} else {
// alternatively, instantiate our own logger
config.Logger = smartlogger.New(loggerVerbosity, smartlogger.File, "/var/log/netsender/")
}
time.Sleep(prepTime)
if !paused {
startRevid()
paused := false
}
// loop in NetSender mode
for *useNetsender {