diff --git a/pkg/monitor-hw/cmd/dell.go b/pkg/monitor-hw/cmd/dell.go index 5658755..f5f2842 100644 --- a/pkg/monitor-hw/cmd/dell.go +++ b/pkg/monitor-hw/cmd/dell.go @@ -2,10 +2,7 @@ package cmd import ( "context" - "os" - "time" - "github.com/cybozu-go/log" "github.com/cybozu-go/well" ) @@ -13,35 +10,7 @@ func monitorDell(ctx context.Context) error { if err := initDell(ctx); err != nil { return err } - if err := resetDell(ctx); err != nil { - return err - } - - env := well.NewEnvironment(ctx) - env.Go(func(ctx context.Context) error { - for { - select { - case <-time.After(time.Duration(opts.resetInterval) * time.Hour): - case <-ctx.Done(): - return nil - } - - if _, err := os.Stat(opts.noResetFile); err == nil { - // if no-reset file exists, skip reset. - continue - } - - if err := resetDell(ctx); err != nil { - log.Error("failed to reset iDRAC", map[string]interface{}{ - log.FnError: err, - }) - // continue working - } - } - }) - - env.Stop() - return env.Wait() + return resetDell(ctx) } func initDell(ctx context.Context) error { diff --git a/pkg/monitor-hw/cmd/root.go b/pkg/monitor-hw/cmd/root.go index 0bd3065..3bbc3ac 100644 --- a/pkg/monitor-hw/cmd/root.go +++ b/pkg/monitor-hw/cmd/root.go @@ -24,7 +24,6 @@ const ( defaultAddress = ":9105" defaultInterval = 60 defaultResetInterval = 24 - defaultNoReset = "/var/lib/setup-hw/no-reset" ) // rootCmd represents the base command when called without any subcommands @@ -126,5 +125,4 @@ func init() { rootCmd.Flags().StringVar(&opts.listenAddress, "listen", defaultAddress, "listening address and port number") rootCmd.Flags().IntVar(&opts.interval, "interval", defaultInterval, "interval of collecting metrics in seconds") rootCmd.Flags().IntVar(&opts.resetInterval, "reset-interval", defaultResetInterval, "interval of resetting iDRAC in hours (dell servers only)") - rootCmd.Flags().StringVar(&opts.noResetFile, "no-reset", defaultNoReset, "path of the no-reset file") }