|
|
@ -1,7 +1,6 @@
|
|
|
|
package cmd
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"github.com/containrrr/watchtower/pkg/filters"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"os/signal"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
@ -11,6 +10,7 @@ import (
|
|
|
|
"github.com/containrrr/watchtower/internal/actions"
|
|
|
|
"github.com/containrrr/watchtower/internal/actions"
|
|
|
|
"github.com/containrrr/watchtower/internal/flags"
|
|
|
|
"github.com/containrrr/watchtower/internal/flags"
|
|
|
|
"github.com/containrrr/watchtower/pkg/container"
|
|
|
|
"github.com/containrrr/watchtower/pkg/container"
|
|
|
|
|
|
|
|
"github.com/containrrr/watchtower/pkg/filters"
|
|
|
|
"github.com/containrrr/watchtower/pkg/notifications"
|
|
|
|
"github.com/containrrr/watchtower/pkg/notifications"
|
|
|
|
t "github.com/containrrr/watchtower/pkg/types"
|
|
|
|
t "github.com/containrrr/watchtower/pkg/types"
|
|
|
|
"github.com/robfig/cron"
|
|
|
|
"github.com/robfig/cron"
|
|
|
@ -123,14 +123,14 @@ func Run(c *cobra.Command, names []string) {
|
|
|
|
log.Fatal(err)
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if err := runUpgradesOnSchedule(filter); err != nil {
|
|
|
|
if err := runUpgradesOnSchedule(c, filter); err != nil {
|
|
|
|
log.Error(err)
|
|
|
|
log.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
os.Exit(1)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func runUpgradesOnSchedule(filter t.Filter) error {
|
|
|
|
func runUpgradesOnSchedule(c *cobra.Command, filter t.Filter) error {
|
|
|
|
tryLockSem := make(chan bool, 1)
|
|
|
|
tryLockSem := make(chan bool, 1)
|
|
|
|
tryLockSem <- true
|
|
|
|
tryLockSem <- true
|
|
|
|
|
|
|
|
|
|
|
@ -156,7 +156,10 @@ func runUpgradesOnSchedule(filter t.Filter) error {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if noStartupMessage, _ := c.PersistentFlags().GetBool("no-startup-message"); !noStartupMessage {
|
|
|
|
log.Info("Starting Watchtower and scheduling first run: " + cron.Entries()[0].Schedule.Next(time.Now()).String())
|
|
|
|
log.Info("Starting Watchtower and scheduling first run: " + cron.Entries()[0].Schedule.Next(time.Now()).String())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cron.Start()
|
|
|
|
cron.Start()
|
|
|
|
|
|
|
|
|
|
|
|
// Graceful shut-down on SIGINT/SIGTERM
|
|
|
|
// Graceful shut-down on SIGINT/SIGTERM
|
|
|
|