Subject | Re: [firebird-support] Shutting donw fbserver programmatically |
---|---|
Author | Nando Dessena |
Post date | 2004-05-31T12:32:05Z |
Paul,
P> You can use the firebird services api to check if there are active
P> attachments to any database on the server. You can then proceed to
P> shutdown the database(s).
OK.
P> Unfortunately, if users are logged in as SYSDBA
P> they wont get kicked off.
Unfortunately this is likely to be the case...
P> The next step is to take whatever action is
P> needed to kill the server - this is platform dependant.
Yep - and this I believe differs between applications and services. If
I issue NET STOP Firebird, or equivalent StopService() API call, I
know that the Firebird service has a chance to terminate gracefully.
I'd do just that if I had it running as a service, but I have it
running a an application instead. My guess is that TerminateProcess()
will not let it shutdown gracefully.
P> It tests to see if there are active connections and warns you if there
P> are. If there are no connections, or you click on OK it kills the
P> process.
Does it use TerminateProcess()?
P> Tests for a connection are only made when running as an
P> application. No tests are made when running as a service. (This is bad.)
Not sure - if it uses StopService() I think the service has a chance
to shutdown gracefully, whereas with TerminateProcess() it can't.
It looks like there's no way to tell fbserver to forcibly close all
connections and shutdown if it runs as an application. I guess that
one could send a WM_CLOSE message to its window, but in my case it
won't work since I have disabled the window creation in firebird.conf.
P> It should be noted that server shutdown is not the same as database
P> shutdown.
Of course.
P> The former is radical and potentially destructive. The latter
P> is benign. The latter is also the source of much head scratching if you
P> forget to bring the database back online.
Yep. What I am in need of is a way to "gracefully kill" the server.
I guess I'm going to do what the tray icon does, if that's the best I
can do with the current tools.
Ciao
--
Nando Dessena
mailto:nandod@...
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================
P> You can use the firebird services api to check if there are active
P> attachments to any database on the server. You can then proceed to
P> shutdown the database(s).
OK.
P> Unfortunately, if users are logged in as SYSDBA
P> they wont get kicked off.
Unfortunately this is likely to be the case...
P> The next step is to take whatever action is
P> needed to kill the server - this is platform dependant.
Yep - and this I believe differs between applications and services. If
I issue NET STOP Firebird, or equivalent StopService() API call, I
know that the Firebird service has a chance to terminate gracefully.
I'd do just that if I had it running as a service, but I have it
running a an application instead. My guess is that TerminateProcess()
will not let it shutdown gracefully.
P> It tests to see if there are active connections and warns you if there
P> are. If there are no connections, or you click on OK it kills the
P> process.
Does it use TerminateProcess()?
P> Tests for a connection are only made when running as an
P> application. No tests are made when running as a service. (This is bad.)
Not sure - if it uses StopService() I think the service has a chance
to shutdown gracefully, whereas with TerminateProcess() it can't.
It looks like there's no way to tell fbserver to forcibly close all
connections and shutdown if it runs as an application. I guess that
one could send a WM_CLOSE message to its window, but in my case it
won't work since I have disabled the window creation in firebird.conf.
P> It should be noted that server shutdown is not the same as database
P> shutdown.
Of course.
P> The former is radical and potentially destructive. The latter
P> is benign. The latter is also the source of much head scratching if you
P> forget to bring the database back online.
Yep. What I am in need of is a way to "gracefully kill" the server.
I guess I'm going to do what the tray icon does, if that's the best I
can do with the current tools.
Ciao
--
Nando Dessena
mailto:nandod@...
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================