www.destructor.de

About | Contact | Impressum


Home |  Code |  Articles |  Misc |  x
Firebird |  Talks |  Character Sets |  x
General |  1.0 |  1.5 |  2.0 |  2.1 |  2.5 |  3.0 |  x

INSTSVC — Installing Firebird as a Windows Service

Use INSTSVC to install or deinstall Firebird as a Service on Windows systems. This will install the Firebird together or without the Guardian service.

General Syntax

instsvc i[nstall] [ -s[uperserver]* | -c[lassic] ]
                  [ -a[uto]* | -d[emand] ]
                  [ -g[uardian] ]
                  [ -l[ogin] username [password] ]
                  [ -i[nteractive] ]
         sta[rt] [ -b[oostpriority] ]
         sto[p]
         q[uery]
         r[emove]

To get brief text help, just invoke instreg.exe with no arguments.

Options

i[nstall]	
Install Firebird as a service
r[emove]
Remove Firebird from services. Note that the Firebird service(s) must be stopped before being removed.
sta[rt]
Start Firebird service
sto[p]
Stop Firebird service
q[uery]
Query the state of the Firebird service(s)
-n[ame] <instance>
Specifies the instance name for the Service (default is "DefaultInstance") to use. Use together with install, start, stop, remove. [Firebird 2.1]
-? Get Help

Install Options

-s[uperserver] | -c[lassic]
Install Firebird as SuperServer (default) or ClassicServer
-a[uto] | -d[emand]
auto: Start Firebird Service at boot time (default) or on demand
-g[uardian]
Install the Guardian Service
-l[ogin] username [password]	
Run Firebird as user <username>
-i[nteractive]
Service is interactive
-n[ame] <instance>
Specifies the instance name for the Service (default is "DefaultInstance")

Specifying a User

It is possible to run Firebird in the context of a specific user:

instsvc i -g -login <user> <password>

This would configure Firebird SuperServer as auto-start, with Guardian, to run under the identity <user> whose password is <password>. If the password is included, the password should not begin with a dash sign (-). If the password is omitted from the commandline, instsvc will prompt for it. In that case, the password will be masked with asterisks as it is typed.

While configuring the services as above, instsvc automatically grants the Windows operating system privilege named "Log on as a Service" to the specified user. This is required, otherwise the service would not be allowed to start. Instsvc is silent about it unless it fails.

To take care of the possibility that the user logging in via the -login switch might be an ordinary user with no administrator privileges on the machine, instsvc adjusts the default security descriptor of the service(s) so that this user can start/stop/query them. This is necessary to enable the Guardian (also running as this user) to start the Firebird server. The user will not be able to uninstall the service(s) nor change their configuration. 

NOTE that instsvc does not CREATE the <user> on the Windows machine. That would not be a good idea. The admin might want to create the user as part of the local machine or as part of a domain and instsvc has no particular need to usurp the admin's responsibility for creating users. 

The user needs to have read/write access to all databases and the firebird.log file. For security reasons, write access to firebird.conf and Firebird executables should NOT be given. On Windows NT/2K/XP it is common to include the domain or server prefix for a user defined on a domain or locally on another server. In the above examples, <user> might take the form of DOMAIN\user or SERVER\user. With no prefix, the user is implicitly a local user on the current machine.

Specifying an Instance Name

Starting with Firebird 2.1, you can specify the instance name to use for the Firebird Service. The default is "DefaultInstance". You specify the instance name with the -n[ame] parameter. So now it is easily possible to install several instances of Firebird as a Service on one machine.

Examples

Install SuperServer with Guardian, auto-start on boot

instsvc install -g

Install ClassicServer, auto-start on boot

instsvc install -c

Start Service

instsvc start
    or
NET START "Firebird Guardian - DefaultInstance"

Stop Service

instsvc stop
    or
NET STOP "Firebird Guardian - DefaultInstance"

Query the Service state

instsvc q

Uninstall Service

instsvc stop
instsvc remove

Install SuperServer with/without guardian, auto-start on boot, instance name is "Firebird 2.1"

instsvc i -g -name "Firebird 2.1"
instsvc i -name "Firebird 2.1"

Start/Stop/Remove the "Firebird 2.1" instance

instsvc start -name "Firebird 2.1"
instsvc stop -name "Firebird 2.1"
instsvc remove -name "Firebird 2.1"

Stefan Heymann,  last edit 2007-11-06

This article has been partly derived from the original Firebird documentation (README.instsvc.txt)
This documentation is licensed under (choose your favorite): GPL, LGPL, CC, IDPL, GFDL, BSD, (did I forget one?)