diff --git a/config.json b/config.json index 3e4af35..0ceaf2e 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,5 @@ { "Interval": "1s", - "States": ["NC"] + "States": ["NC"], + "Once": true } diff --git a/config/config.go b/config/config.go index 79838ca..8c621a1 100644 --- a/config/config.go +++ b/config/config.go @@ -12,6 +12,7 @@ type Config struct { Interval Duration States []State Storage []string + Once bool lock sync.Mutex db storage.DB diff --git a/main.go b/main.go index cbd26ec..0b81c1e 100644 --- a/main.go +++ b/main.go @@ -22,8 +22,12 @@ func _main() error { if err := once(); err != nil { return err } + if config.Get().Once { + break + } time.Sleep(config.Get().Interval.Get()) } + return nil } func once() error {