postgresql 8.2 startup script - Mailing list pgsql-general

From Aleksandar Sosic
Subject postgresql 8.2 startup script
Date
Msg-id 54b351d21003061516w7b8b7007s9835efaa7b785bf2@mail.gmail.com
Whole thread Raw
Responses Re: postgresql 8.2 startup script  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Re: postgresql 8.2 startup script  (Vick Khera <vivek@khera.org>)
List pgsql-general
Hi,

I use FreeBSD 7.2-RELEASE #0: Fri May  1 07:18:07 UTC 2009

I installed the above port and my /usr/local/etc/rc.d/postgresql
script doesn't work...it doesn't initialize the db, it doesn't make it
start....

If i do it "manually" with the on-installation created user pgsql:
[pgsql@zennaVo /]$ initdb -D /usr/local/pgsql/data
[pgsql@zennaVo /]$  pg_ctl -D /usr/local/pgsql/data start

it works....

What's the problem with the startup script? am I doing
something wrong?

My startup script:
------------------------
#!/bin/sh

# $FreeBSD: ports/databases/postgresql83-server/files/postgresql.in,v
1.2 2007/01/09 16:29:35 girgen Exp $
#
# PROVIDE: postgresql
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable PostgreSQL:
#
#  postgresql_enable="YES"
#  # optional
#  postgresql_data="/usr/local/pgsql/data"
#  postgresql_flags="-w -s -m fast"
#  postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
#  postgresql_class="default"
#
# See /usr/local/share/doc/postgresql/README-server for more info
#
# This scripts takes one of the following commands:
#
#   start stop restart reload status initdb
#
# For postmaster startup options, edit ${postgresql_data}/postgresql.conf

prefix=/usr/local
command=${prefix}/bin/pg_ctl

. /etc/rc.subr

load_rc_config postgresql

# set defaults
postgresql_enable=${postgresql_enable:-"NO"}
postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
postgresql_user=pgsql
eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data"}
postgresql_class=${postgresql_class:-"default"}
postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8
--lc-collate=C"}

name=postgresql
rcvar=`set_rcvar`
command_args="-D ${postgresql_data} ${postgresql_flags}"
extra_commands="reload initdb"

start_cmd="postgresql_command start"
stop_cmd="postgresql_command stop"
restart_cmd="postgresql_command restart"
reload_cmd="postgresql_command reload"
status_cmd="postgresql_command status"

initdb_cmd="postgresql_initdb"

postgresql_command()
{
    su -l ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
}

postgresql_initdb()
{
    su -l -c ${postgresql_class} ${postgresql_user} -c "exec
${prefix}/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data}"
}

run_rc_command "$1"
------------------------
--
Aleksandar Sosic
email: alex.sosic(at)gmail<dot>com

pgsql-general by date:

Previous
From: Megha
Date:
Subject: Evaluation of Postgresql using DBT2
Next
From: Megha
Date:
Subject: Evaluation of Postgresql using DBT2