[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 | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/setup/pgbench-setup b/setup/pgbench-setup index cc0ce37d..3aa1f7f5 100755 --- a/setup/pgbench-setup +++ b/setup/pgbench-setup @@ -23,29 +23,18 @@ postgres_run_log() log_cmd sudo -u postgres "$@" }
-init_postgresql() +start_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) +start_postgresql
-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"