When starting postgres, it hangs like it is still connected to stdout

Started by Susan Cassidyover 12 years ago5 messagesgeneral
Jump to latest
#1Susan Cassidy
susan.cassidy@decisionsciencescorp.com

When I start postgres using postgres -D $PGDATA, it hangs, and I see that
postgres and all the other attendant processes are running, but I never get
my prompt back.

If I hit ctl/C, postgres ends running.

I can't seem to figure out why.

This is postgres 9.2.

What am I doing wrong?

Thanks,
Susan

#2Shaun Thomas
sthomas@optionshouse.com
In reply to: Susan Cassidy (#1)
Re: When starting postgres, it hangs like it is still connected to stdout

When I start postgres using postgres -D $PGDATA, it hangs, and I see that
postgres and all the other attendant processes are running, but I never
get my prompt back.

Don't start PostgreSQL with the 'postgres' command. That's the name of the actual server process. You want to use the control script, normally named pg_ctl. You call it like this:

pg_ctl -D $PGDATA start

Stop it like this:

pg_ctl -D $PGDATA stop

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In reply to: Susan Cassidy (#1)
Re: When starting postgres, it hangs like it is still connected to stdout

On 07/01/2014 19:47, Susan Cassidy wrote:

When I start postgres using postgres -D $PGDATA, it hangs, and I see
that postgres and all the other attendant processes are running, but I
never get my prompt back.

If I hit ctl/C, postgres ends running.

I can't seem to figure out why.

You're running the postgres program directly in the foreground, rather
than as a daemon. This is handy for trying things out, but you'll
generally want to start and stop it using the package's control scripts.
On Debian, for example:

/etc/init.d/postgresql start

or

service postgresql start

Or you can use pg_ctl:

http://www.postgresql.org/docs/9.2/static/app-pg-ctl.html

HTH,

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Joe Van Dyk
joe@tanga.com
In reply to: Susan Cassidy (#1)
Re: When starting postgres, it hangs like it is still connected to stdout

On Tue, Jan 7, 2014 at 11:47 AM, Susan Cassidy <
susan.cassidy@decisionsciencescorp.com> wrote:

When I start postgres using postgres -D $PGDATA, it hangs, and I see that
postgres and all the other attendant processes are running, but I never get
my prompt back.

If I hit ctl/C, postgres ends running.

I can't seem to figure out why.

This is postgres 9.2.

What am I doing wrong?

Thanks,
Susan

$ postgres -D $PGDATA &

should start postgres in the background. (the '&' at the end tells it to
put the process in the backgroudn)

If you want it running outside your shell, you should use pg_ctl.
$ pg_ctl --help
pg_ctl is a utility to initialize, start, stop, or control a PostgreSQL
server.

#5Susan Cassidy
susan.cassidy@decisionsciencescorp.com
In reply to: Shaun Thomas (#2)
Re: When starting postgres, it hangs like it is still connected to stdout

The initdb command said I could use that command, but pg_ctl works fine
now. I should have tried that before. I have always used pg_ctl in the
past, don't know why I just went with the postgres command.

Thanks,
Susan

On Tue, Jan 7, 2014 at 11:50 AM, Shaun Thomas <sthomas@optionshouse.com>wrote:

Show quoted text

When I start postgres using postgres -D $PGDATA, it hangs, and I see that
postgres and all the other attendant processes are running, but I never
get my prompt back.

Don't start PostgreSQL with the 'postgres' command. That's the name of the
actual server process. You want to use the control script, normally named
pg_ctl. You call it like this:

pg_ctl -D $PGDATA start

Stop it like this:

pg_ctl -D $PGDATA stop

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions
related to this email