On Tuesday 10 July 2007 04:25, David Millis wrote:
> Minor typo in the first email:
> MENU_CLASS_NAME = "BaculaFD Tray Icon"
> 
> The interim workaround was successful. I used a hex
> editor on one bacula-fd.exe to change the string to
> "BaculaFD2Tray Icon".
> 
> It worked. For clarity, here's what my custom services
> look like:
> bacula-fd_local
> "C:\Program Files\Bacula\bin\bacula-fd.exe" /service
> -c "C:\Program Files\Bacula\bacula-fd.conf"
> 
> bacula-fd_cluster
> "G:\Program Files\Bacula\bin\bacula-fd.exe" /service
> -c "G:\Program Files\Bacula\bacula-fd.conf"
> 
> 
> Just for fun, I ran the two exes with the /run
> argument from a prompt instead; they made their own
> tray icons as expected.

Thanks for your emails concerning running two copies of Bacula on Win32.  I'm 
not really sure why it is necessary, because if I am not mistaken, it can 
listen to multiple addresses.  In any case, you seem to have found a nice 
solution.

Sometime in the not too distant future, we will be removing the tray monitor 
from the FD, which will mean that it will be much easier to run two copies of 
the FD ...

Best regards,

Kern

=================================

Bacula-fd Windows Correction
 Date: 2007-07-10 01:26
 From: David Millis <[EMAIL PROTECTED]>
 To: [EMAIL PROTECTED]
 
I need to run two instances of the file daemon service
on a Windows cluster, one to cover each node's c:
drive and one to move with a drive&IP that fail-over
between them.

I used the sc.exe command to create a
'bacula-fd_local' and 'bacula-fd_cluster' service
identical to the one your installer makes. The problem
is that whichever instance is started second runs but
never binds to a port regardless of whether it's on a
different port and/or a different IP. In case you're
wondering, I used Sysinternals Process Explorer to
check.

I believe this is because it's waiting for an
invisible MessageBox to be clicked before exiting.
Your source code shows that even when run as a service
on WinNT, it creates a tray icon and if it sees one
already exists, it makes a popup and exits.



Here's the relevant code...

MENU_CLASS_NAME = "Bacula Tray Icon"


BaculaAppMain
(winmain.cpp)
On Win9x, BaculaServiceMain starts it (winservice.cpp)
On WinNT, ServiceWorkThread starts it (winservice.cpp)
-------------
HWND hservwnd = FindWindow(MENU_CLASS_NAME, NULL);
if (hservwnd != NULL) {
  /* We don't allow multiple instances! */
  MessageBox(NULL, _("Another instance of Bacula is
already running"), szAppName, MB_OK);
  _exit(0);
}

pthread_create(&tid, NULL,  Main_Msg_Loop, (void *)0);
-------------



Main_Msg_Loop
(winmain.cpp)
Creates the tray window called MENU_CLASS_NAME
BaculaAppMain starts it (above)
-------------
bacMenu *menu = new bacMenu();
-------------


This code was copied from the SVN repository on
07/09/2007.
http://bacula.svn.sourceforge.net/viewvc/bacula/branches/Branch-2.0/bacula/src/win32/filed/



I didn't look too closely into this workaround, but
enclosing the popup and the 'new bacMenu' code in
something like an 'if (!isAService())' should make it
work. And if there's ever an instance running as an
app, its tray will collect all their messages...

Better yet, make the tray a separate application, and
let daemons find&fill it if it's available.

I'm hesitant to suggest moving vars like this or
servicename into an ini file since that would make the
win32 branch even more different from the rest.

In the mean time, I'll try to patch one of my exe's to
expect a different MENU_CLASS_NAME.


                                         David

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to