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