postgresql 8.2 startup script

From: Aleksandar Sosic <alex(dot)sosic(at)gmail(dot)com>
To: questions(at)PostgreSQL(dot)ORG
Subject: postgresql 8.2 startup script
Date: 2010-03-06 23:16:16
Message-ID: 54b351d21003061516w7b8b7007s9835efaa7b785bf2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)zennaVo /]$ initdb -D /usr/local/pgsql/data
[pgsql(at)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Ribe 2010-03-07 01:00:48 Re: What's the best way to deal with the pk_seq sequence value after a restore (bulk loading)?
Previous Message Tom Lane 2010-03-06 21:37:56 Re: What's the best way to deal with the pk_seq sequence value after a restore (bulk loading)?