Skip to content

Commit

Permalink
Add the timestamp when creating the backup file
Browse files Browse the repository at this point in the history
  • Loading branch information
ph committed Mar 27, 2019
1 parent c8c32b9 commit b9b64b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x-pack/libbeat/management/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package management
import (
"fmt"
"os"
"time"

"github.com/pkg/errors"

Expand Down Expand Up @@ -52,8 +53,10 @@ func Enroll(

configFile := cfgfile.GetDefaultCfgfile()

ts := time.Now().Unix()

// backup current settings:
backConfigFile := configFile + ".bak"
backConfigFile := configFile + "." + string(ts) + ".bak"
fmt.Println("Saving a copy of current settings to " + backConfigFile)
err = file.SafeFileRotate(backConfigFile, configFile)
if err != nil {
Expand Down

0 comments on commit b9b64b3

Please sign in to comment.