Thread: pg_ctl start leaves dos window open

pg_ctl start leaves dos window open

From
Richard van den Berg
Date:

I am running PostgreSQL 8.1 on Windows Server 2003. Our setup should allow a normal (non-administrator) user to start the database. Since the user is not allowed to start services, I am trying a direct "pg_ctl start" approach. However, running this from a shortcut, leaves a dos window open with the words "postmaster starting". After stopping postgres, "logger shutting down" appears before the window is closed. I have tried to redirect stdout, stderr and stdin to nul, but this just makes the window empty, it still does not disappear until the database is stopped. Using the -l option of pg_ctl also does not help.

Is there a way for this setup to work, without the dos box being visable all the time? I use system logging, so I don't need the stdout/stderr of pg_ctl.

Sincerely,

Richard van den Berg, CISSP
-------------------------------------------
Trust Factory B.V. |     www.dna-portal.net
Bazarstraat 44a    |  www.trust-factory.com
2518AK The Hague   |  Phone: +31 70 3620684
The Netherlands    |  Fax  : +31 70 3603009
-------------------------------------------

Re: pg_ctl start leaves dos window open

From
"Magnus Hagander"
Date:
> I am running PostgreSQL 8.1 on Windows Server 2003. Our setup
> should allow a normal (non-administrator) user to start the
> database. Since the user is not allowed to start services, I
> am trying a direct "pg_ctl start" approach. However, running
> this from a shortcut, leaves a dos window open with the words
> "postmaster starting". After stopping postgres, "logger
> shutting down" appears before the window is closed. I have
> tried to redirect stdout, stderr and stdin to nul, but this
> just makes the window empty, it still does not disappear
> until the database is stopped. Using the -l option of pg_ctl
> also does not help.
>
> Is there a way for this setup to work, without the dos box
> being visable all the time? I use system logging, so I don't
> need the stdout/stderr of pg_ctl.

That's the way it works. If you want it in the background, you need to
use a service. There are a couple of options tom ake it less ugly,
though:

1) Users *can* start and stop services, if you just give them
permissions to do so. This can be done on an individual service basis.
You use the security configuration editor for that.

2) You can start the window minimized, with "start /min pg_ctl .... ...
"

3) You can write your own small program that starts the process with a
hidden window.

//Magnus

Re: pg_ctl start leaves dos window open

From
Richard van den Berg
Date:

"Magnus Hagander" <mha@sollentuna.net> wrote:
> > 1) Users *can* start and stop services, if you just give them
> > permissions to do so. This can be done on an individual service basis.
> > You use the security configuration editor for that.


Thanks for the hint. I've found how to do that at: http://support.microsoft.com/default.aspx?scid=kb;en-us;288129
however, the services implementation in windows is completely braindead: an administrator gives the rights to user postgres to start postgresql (fine), but since the service needs to run as user postgres, I need to enter the password in the service definition. Even when the user postgres is logged on and wants to start the service. I don't want my password to be stored in the registry, so I am still stuck. *sigh*

All this hassle for what in unix would only require the addition of a single character: &

Richard van den Berg, CISSP
-------------------------------------------
Trust Factory B.V. |     www.dna-portal.net
Bazarstraat 44a    |  www.trust-factory.com
2518AK The Hague   |  Phone: +31 70 3620684
The Netherlands    |  Fax  : +31 70 3603009
-------------------------------------------