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

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

From
Susan Cassidy
Date:
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

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

From
Shaun Thomas
Date:
> 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
controlscript, 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


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

From
Raymond O'Donnell
Date:
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


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

From
Joe Van Dyk
Date:

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. 

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

From
Susan Cassidy
Date:
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:
> 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