Обсуждение: postgresql 8.2 startup script

Поиск
Список
Период
Сортировка

postgresql 8.2 startup script

От
Aleksandar Sosic
Дата:
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

Re: postgresql 8.2 startup script

От
Alban Hertroys
Дата:
On 7 Mar 2010, at 24:16, Aleksandar Sosic wrote:

> 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....


Did you add it to /etc/rc.conf?

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:1036,4b93fde9296921763426367!



Re: postgresql 8.2 startup script

От
Vick Khera
Дата:
On Sat, Mar 6, 2010 at 6:16 PM, Aleksandar Sosic <alex.sosic@gmail.com> wrote:
> What's the problem with the startup script? am I doing
> something wrong?
>

The startup script starts the service at boot, or when manually run.
If you run it with the "init" command it will do that.  Normally it
just starts/stops the server.  Also, be sure to enable the service in
/etc/rc.conf like you would any other service.