Thread: Re: postgres startup method for ubuntu

Re: postgres startup method for ubuntu

From
"T.J. Adami"
Date:
On 30 jan, 04:14, Jon Hancock <redstarl...@gmail.com> wrote:
> I have compiled postgres 8.3rc2 on ubuntu 7.04 and seem to a have
> working install.
> To start postgres, I do the following:
>
> > su postgres
> > /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data &
>
> ok, that works for dev mode.  But what is the recommended approach to
> launch postgres at system boot?
> Sure, I can hack the above command in an init.d script and if it seems
> to work, thats nice.
> But since I'm a nube here, I think I should ask for the refined
> approach for a startup script.  For example, in the mysql world, we
> have a safe_mysql script which takes care of startup "best practices".
>
> thanks, Jon

I am also searching for a more 'professional' way to startup and
shutdown postgresql on ubuntu and debian systems.

Everytime I deploy a PostgreSQL server in a ubuntu or debian based
server, I create some scripts called pg_start, pg_stop and pg_reload,
save them on default postgresql home dir. Then I create symbolic links
on /usr/bin, and so on I put pg_start on /etc/init.d/bootmisc.sh.

However, I want to deploy it as a "native" linux service, as 'cron' or
'network', and really I dunno how to do it.

Re: postgres startup method for ubuntu

From
Karsten Hilbert
Date:
On Thu, Jan 31, 2008 at 02:35:01AM -0800, T.J. Adami wrote:

> Everytime I deploy a PostgreSQL server in a ubuntu or debian based
> server, I create some scripts called pg_start, pg_stop and pg_reload,
> save them on default postgresql home dir. Then I create symbolic links
> on /usr/bin, and so on I put pg_start on /etc/init.d/bootmisc.sh.
>
> However, I want to deploy it as a "native" linux service, as 'cron' or
> 'network', and really I dunno how to do it.

Debian does it for me nicely on bootup. I wonder why you
think you need to start it manually ?

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

Re: postgres startup method for ubuntu

From
"Daniel Verite"
Date:
    T.J. Adami wrote:

> I am also searching for a more 'professional' way to startup and
> shutdown postgresql on ubuntu and debian systems.

The source comes with a startup script that can be installed by
running:
# cp contrib/start-scripts/linux /etc/init.d/postgresql
# update-rc.d postgresql defaults
(update-rc.d is to debian-based systems what chkconfig is to
Redhat-based systems).

--
 Daniel
 PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org

Re: postgres startup method for ubuntu

From
"T.J. Adami"
Date:
On 31 jan, 12:24, dan...@manitou-mail.org ("Daniel Verite") wrote:
>         T.J. Adami wrote:
>
> > I am also searching for a more 'professional' way to startup and
> > shutdown postgresql on ubuntu and debian systems.
>
> The source comes with a startup script that can be installed by
> running:
> # cp contrib/start-scripts/linux /etc/init.d/postgresql
> # update-rc.d postgresql defaults
> (update-rc.d is to debian-based systems what chkconfig is to
> Redhat-based systems).
>
> --
>  Daniel
>  PostgreSQL-powered mail user agent and storage:http://www.manitou-mail.org
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org/

> Debian does it for me nicely on bootup. I wonder why you
> think you need to start it manually ?
>
> Karsten

I always compile my own version from sources for Python and Perl
support, and also because of newest versions that are update with a
lack of time (for reasonable test reasons).


> The source comes with a startup script that can be installed by
> running:
> # cp contrib/start-scripts/linux /etc/init.d/postgresql
> # update-rc.d postgresql defaults
> (update-rc.d is to debian-based systems what chkconfig is to
> Redhat-based systems).
>
> --
>  Daniel

This adds shutdown scripts too? I need the server shutdown by 'pg_ctl
stop', not by linux killing the process (init 0 or shutdown commands
are very useful sometimes ;) ). I know this is a specific distro
question, however we started this thread yet...

Re: postgres startup method for ubuntu

From
"Daniel Verite"
Date:
    T.J. Adami wrote:

> > The source comes with a startup script that can be installed by
> > running:
> > # cp contrib/start-scripts/linux /etc/init.d/postgresql
> > # update-rc.d postgresql defaults
> > (update-rc.d is to debian-based systems what chkconfig is to
> > Redhat-based systems).
> >
> > --
> >  Daniel
>
> This adds shutdown scripts too? I need the server shutdown by 'pg_ctl
> stop', not by linux killing the process (init 0 or shutdown commands
> are very useful sometimes ;)


Yes. update-rc.d set things up so that at boot time the system will
execute: /etc/init.d/postgresql start, and at shutdown time:
/etc/init.d/postgresql stop

Additionally, the root user can also execute when needed:
/etc/init.d/postgresql {stop|start|reload|restart}

That's the standard way of starting and stopping services on linux,
both automatically and manually.

--
 Daniel
 PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org