[why] when after installed postgresql-server, postgres(user) is already created, so initializing the postgresql directly.
Signed-off-by: Hu XueJiao 1034502035@qq.com --- setup/pgbench-setup | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/setup/pgbench-setup b/setup/pgbench-setup index cc0ce37da..ea55b2ebc 100755 --- a/setup/pgbench-setup +++ b/setup/pgbench-setup @@ -25,28 +25,17 @@ postgres_run_log()
init_postgresql() { - grep -q postgres /etc/passwd && return - - useradd --home-dir /var/lib/postgresql --no-create-home --no-user-group --gid nogroup --system postgres - data_dir=/var/lib/postgresql/data + data_dir=/var/lib/pgsql/data mkdir -p "$data_dir" - chown postgres "$data_dir" - - bin_dir=/usr/lib/postgresql/*/bin - is_clearlinux && bin_dir=/usr/bin
- postgres_run $bin_dir/initdb -D "$data_dir" 2>&1 - postgresql_conf_file="$data_dir"/postgresql.conf - run_dir=/var/run/postgresql - mkdir -p "$run_dir" - chown postgres "$run_dir" - postgres_run $bin_dir/pg_ctl -D "$data_dir" start + postgresql-setup initdb + service postgresql start }
-postgresql_conf_file=$(find /etc/postgresql -name postgresql.conf | head -1) - init_postgresql
+postgresql_conf_file=$(find "$data_dir" -name postgresql.conf | head -1) + [ -n "$max_wal_size" ] && log_eval "echo 'max_wal_size = $max_wal_size' >> $postgresql_conf_file"