Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Aug 20, 2023
1 parent 1262ef5 commit 7fffe17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/internal/database/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,14 @@ func (db *Postgres) Upgrade() error {
return err
}
// initdb -D /data/postgres-new
cmd := exec.Command(postgresInitDBCmd, newDataDirTemp)
err = syscall.Setuid(uid)
if err != nil {
return err
}
cmd := exec.Command(postgresInitDBCmd, "-D", newDataDirTemp)
out, err := cmd.CombinedOutput()
if err != nil {
db.log.Infow("unable to run initdb on new new datadir, skipping upgrade", "error", err)
db.log.Infow("unable to run initdb on new new datadir, skipping upgrade", "output", string(out), "error", err)
return nil
}
db.log.Infow("new database director initialized", "output", string(out))
Expand Down

0 comments on commit 7fffe17

Please sign in to comment.