mirror of
https://github.com/containrrr/watchtower.git
synced 2025-03-03 15:32:37 +02:00
add --no-startup-message flag
This commit is contained in:
parent
b051327f1b
commit
fc3decce3a
11
cmd/root.go
11
cmd/root.go
@ -1,7 +1,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/containrrr/watchtower/pkg/filters"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
@ -11,6 +10,7 @@ import (
|
||||
"github.com/containrrr/watchtower/internal/actions"
|
||||
"github.com/containrrr/watchtower/internal/flags"
|
||||
"github.com/containrrr/watchtower/pkg/container"
|
||||
"github.com/containrrr/watchtower/pkg/filters"
|
||||
"github.com/containrrr/watchtower/pkg/notifications"
|
||||
t "github.com/containrrr/watchtower/pkg/types"
|
||||
"github.com/robfig/cron"
|
||||
@ -123,14 +123,14 @@ func Run(c *cobra.Command, names []string) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := runUpgradesOnSchedule(filter); err != nil {
|
||||
if err := runUpgradesOnSchedule(c, filter); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func runUpgradesOnSchedule(filter t.Filter) error {
|
||||
func runUpgradesOnSchedule(c *cobra.Command, filter t.Filter) error {
|
||||
tryLockSem := make(chan bool, 1)
|
||||
tryLockSem <- true
|
||||
|
||||
@ -156,7 +156,10 @@ func runUpgradesOnSchedule(filter t.Filter) error {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Info("Starting Watchtower and scheduling first run: " + cron.Entries()[0].Schedule.Next(time.Now()).String())
|
||||
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())
|
||||
}
|
||||
|
||||
cron.Start()
|
||||
|
||||
// Graceful shut-down on SIGINT/SIGTERM
|
||||
|
@ -18,6 +18,7 @@ The types of notifications to send are set by passing a comma-separated list of
|
||||
## Settings
|
||||
|
||||
- `--notifications-level` (env. `WATCHTOWER_NOTIFICATIONS_LEVEL`): Controls the log level which is used for the notifications. If omitted, the default log level is `info`. Possible values are: `panic`, `fatal`, `error`, `warn`, `info` or `debug`.
|
||||
- `--no-startup-message` (env. `WATCHTOWER_NOTIFICATION_NO_STARTUP_MESSAGE`): Prevents watchtower from sending a startup message.
|
||||
|
||||
## Available services
|
||||
|
||||
|
@ -123,6 +123,12 @@ func RegisterNotificationFlags(rootCmd *cobra.Command) {
|
||||
viper.GetString("WATCHTOWER_NOTIFICATIONS_LEVEL"),
|
||||
"The log level used for sending notifications. Possible values: panic, fatal, error, warn, info or debug")
|
||||
|
||||
flags.BoolP(
|
||||
"no-startup-message",
|
||||
"",
|
||||
viper.GetBool("WATCHTOWER_NOTIFICATION_NO_STARTUP_MESSAGE"),
|
||||
"Prevents watchtower from sending a startup message")
|
||||
|
||||
flags.StringP(
|
||||
"notification-email-from",
|
||||
"",
|
||||
|
Loading…
x
Reference in New Issue
Block a user