Subject Re: WSH to test & start Firebird service on XP?
Author Photios Loupis (4T)
--- In firebird-support@yahoogroups.com, "rocksolidrobot"
<rocksolidrobot@y...> wrote:
>
> I'm looking at pages 60,61 of The Firebird book.
> I want like a quick way test if firebird is going,
> and if not, to start it up. In the context of...
>
> WS=new ActiveXObject('WScript.Shell')
> WS.Exec(cmd_1)
>
> I tried...
>
> cmd_1="NET START FirebirdServer"
>
> it replied with:
> The service name is invalid.
> More help is available by typing NET HELPMSG 2185.
>
> I tried...
> cmd_1='"C:\Program Files\Firebird\Firebird_1_5\bin\instsvc.exe"
start'
>
> it replied:
> Service "Firebird Guardian - DefaultInstance" successfully started.
>
>
> What is a quick test to check if Firebird is running?
> maybe there is a "start_only_if_stopped" switch on instsvc.exe
> in the boook I saw some stuff about ping ~ but it seemed
> complicated with server locations, database locations, and
> passwords.
>
>
> instsvc.exe Usage:
> instsvc i[nstall] [ -s[uperserver]* | -c[lassic] ]
> [ -a[uto]* | -d[emand] ]
> [ -g[uardian] ]
> [ -l[ogin] username [password] ]
>
> sta[rt] [ -b[oostpriority] ]
> sto[p]
> q[uery]
> r[emove]
>
> This utility should be located and run from the 'bin' directory
> of your Firebird installation.
>
> '*' denotes the default values
> '-z' can be used with any other option, prints version
> 'username' refers by default to a local account on this machine.
> Use the format 'domain\username' or 'server\username' if
> appropriate.
>
>
> Maybe XP can test the service with one of these?
> soemthing like: NET ISGOING FirebirdServer, but I don't
> see that options...
>
> The syntax of this command is:
> NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP
|
> HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |
> SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]
>
>
> thanks

I have never had an issue with the Firebird Guardian not being
started or stopping by itself but I have had other services
that "misbehave". Following is some script that may be able to help
you: Save this in a text file with an extension of .vbs and run this
on the machine with the offending service. The service name can be
determined from the services application that come with windows,
double-click on the service and determine its name from the
label "Service Name" in the dialog box.

sComputer = "." ' We are using the local machine
sServiceName = "FirebirdGuardian" ' Use the Windows Services
Application to determine the service name

' Build the WMI Object
Set objWMIService = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")

' Get a reference to the Service(s)
Set colServices = objWMIService.ExecQuery ("SELECT * FROM
Win32_Service WHERE Name = '" & sServiceName & "' AND State
= 'Stopped' ")

' Start service(s)
For Each objService in colServices
errReturnCode = objService.StartService()
If errReturnCode <> 0 Then
wscript.echo strComputer & vbTab & objService.Name & vbTab &
errReturnCode
Else
wscript.echo strComputer & vbTab & objService.Name & "
Started - " & vbTab & Now
End If
Next