mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-31 06:08:49 +01:00
Add --health-check command line switch. Fixes #1257
This commit is contained in:
parent
7948242260
commit
3acc52ed59
6 changed files with 34 additions and 1 deletions
|
|
@ -152,6 +152,15 @@ func Run(c *cobra.Command, names []string) {
|
|||
enableMetricsAPI, _ := c.PersistentFlags().GetBool("http-api-metrics")
|
||||
unblockHTTPAPI, _ := c.PersistentFlags().GetBool("http-api-periodic-polls")
|
||||
apiToken, _ := c.PersistentFlags().GetString("http-api-token")
|
||||
healthCheck, _ := c.PersistentFlags().GetBool("health-check")
|
||||
|
||||
if healthCheck {
|
||||
// health check should not have pid 1
|
||||
if os.Getpid() == 1 {
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if rollingRestart && monitorOnly {
|
||||
log.Fatal("Rolling restarts is not compatible with the global monitor only flag")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue