windows service

Started by Garry Saddingtonalmost 17 years ago5 messagesgeneral
Jump to latest
#1Garry Saddington
garry@schoolteachers.co.uk

Anyone know how to install Postgresql as a windows service from the command
line.
I have this as the correct syntax:
"c:\scholarpack\postgres\bin\pg_ctl.exe" runservice -w -N "P4" -D
"c:\scholarpack\data"

Where P4 is the name of the service. However, I can not get the sc command to
accept the above string on the command line. Any help would be much
appreciated.
Regards
Garry

#2Thomas Kellerer
spam_eater@gmx.net
In reply to: Garry Saddington (#1)
Re: windows service

garry@schoolteachers.co.uk wrote on 03.05.2009 13:32:

Anyone know how to install Postgresql as a windows service from the command
line.
I have this as the correct syntax:
"c:\scholarpack\postgres\bin\pg_ctl.exe" runservice -w -N "P4" -D
"c:\scholarpack\data"

Where P4 is the name of the service. However, I can not get the sc command to
accept the above string on the command line. Any help would be much
appreciated.

If the service is already registered with the name "P4", you can start it using

net start P4

Thomas

#3Dave Page
dpage@pgadmin.org
In reply to: Garry Saddington (#1)
Re: windows service

On Sun, May 3, 2009 at 12:32 PM, <garry@schoolteachers.co.uk> wrote:

Anyone know how to install Postgresql as a windows service from the command
line.
I have this as the correct syntax:
"c:\scholarpack\postgres\bin\pg_ctl.exe" runservice -w -N "P4" -D
"c:\scholarpack\data"

Where P4 is the name of the service. However, I can not get the sc command to
accept the above string on the command line. Any help would be much
appreciated.

pg_ctl can install itself:

pg_ctl register [-N servicename] [-U username] [-P password] [-D
datadir] [-w] [-t seconds] [-o options]

http://www.postgresql.org/docs/8.3/interactive/app-pg-ctl.html

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com

#4Adam Ruth
adamruth@mac.com
In reply to: Garry Saddington (#1)
Re: windows service

One option is sc.exe command.

sc create postgresql binPath= "^"c:\scholarpack\postgres\bin
\pg_ctl.exe^" runservice -w -N ^"P4^" -D ^"c:\scholarpack\data^"" -
start auto

On 03/05/2009, at 9:32 PM, garry@schoolteachers.co.uk wrote:

Show quoted text

Anyone know how to install Postgresql as a windows service from the
command
line.
I have this as the correct syntax:
"c:\scholarpack\postgres\bin\pg_ctl.exe" runservice -w -N "P4" -D
"c:\scholarpack\data"

Where P4 is the name of the service. However, I can not get the sc
command to
accept the above string on the command line. Any help would be much
appreciated.
Regards
Garry

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

#5John R Pierce
pierce@hogranch.com
In reply to: Adam Ruth (#4)
Re: windows service

Adam Ruth wrote:

One option is sc.exe command.

sc create postgresql binPath=
"^"c:\scholarpack\postgres\bin\pg_ctl.exe^" runservice -w -N ^"P4^" -D
^"c:\scholarpack\data^"" -start auto

except, on a SC CREATE, you'd need to specify a lot more than just the
binpath. I'd suspect at least obj= username password= password

Far better to use the pg_ctl register command as Dave Page said...