mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 06:06:38 +01:00
Merge pull request #282 from techknowlogick/check-if-len-gt-0
This commit is contained in:
commit
2faf3cfb2f
1 changed files with 3 additions and 2 deletions
5
main.go
5
main.go
|
|
@ -66,10 +66,11 @@ func before(c *cli.Context) error {
|
||||||
|
|
||||||
pollingSet := c.IsSet("interval")
|
pollingSet := c.IsSet("interval")
|
||||||
cronSet := c.IsSet("schedule")
|
cronSet := c.IsSet("schedule")
|
||||||
|
cronLen := len(c.String("schedule"))
|
||||||
|
|
||||||
if pollingSet && cronSet {
|
if pollingSet && cronSet && cronLen > 0 {
|
||||||
log.Fatal("Only schedule or interval can be defined, not both.")
|
log.Fatal("Only schedule or interval can be defined, not both.")
|
||||||
} else if cronSet {
|
} else if cronSet && cronLen > 0 {
|
||||||
scheduleSpec = c.String("schedule")
|
scheduleSpec = c.String("schedule")
|
||||||
} else {
|
} else {
|
||||||
scheduleSpec = "@every " + strconv.Itoa(c.Int("interval")) + "s"
|
scheduleSpec = "@every " + strconv.Itoa(c.Int("interval")) + "s"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue