Re: How does beagle get stopped?



Hi Joe,

Am Mittwoch, den 17.10.2007, 16:14 -0400 schrieb Joe Shaw:
> Hi,
> 
> On 10/17/07, Max Wiehle <max wiehle gmail com> wrote:
> > I am currently working on beagle++ and for us it's quite crucial to shut
> > down beagled cleanly and then shut down the rdf repository as well. I
> > did write a shell script that does just that if beagle is terminated,
> > shut down with beagle-shutdown or a TERM or INT signal is send to the
> > script. However this does not seem to work when logging out of a gnome
> > session or shutting down the computer.
> > So how does this normally work. What stops beagle when i halt my system?
> 
> The beagle daemon tries to connect to the X server when it's started
> and will start its shutdown process if the X connection is severed
> (because the user logged out, for instance).
> 
> The code which does this is in beagled/BeagleDaemon.cs.  Look for
> XssInit() and XIOErrorHandler.

I took a look at the code and that is exactly what happens. But "beagle
--fg" does not seem to return. I use it in a script that waits for
beagled to return to stop the repository afterwards. This works fine
with beagle-shutdown. However it does not seem to work when logging
out /shutting down.

The relevant part of the script looks like this:

        trap on_trap INT TERM
        
        # start beagle:
        echo "Starting beagle and watching it..." >&9
        
        # We hand on all variables but --bg to beagled so it can deal
        with them.
        /usr/max/bin/beagled --fg "$REDUCED_ARGS" >&9
        
        echo "Beagle returned!" >&9
        
The log at &9 prints the following:

        Starting beagle and watching it...
        Always: Starting Beagle Daemon (version 0.2.18)
        Always: Running on Mono 1.2.5
        Always: Using sqlite version 3
        Always: Command Line: /usr/max/lib/beagle/BeagleDaemon.exe --fg
        Debug: Established a connection to the X server
        Debug: Reniced process to 7
        ...
        Debug: Lost our connection to the X server!  Trying to shut down
        gracefully
        Always: Shutdown requested
        Debug: Stopping inotify threads
        Debug: Server '/home/max/.beagle++/socket' shut down
        Debug: All workers have finished.  Exiting main loop.
        Debug: Xlib is forcing us to exit!
        Debug: Live ExceptionHandlingThread: EHT 14186 [14106
        BeagleDaemon] Beagle.Util.Inotify:SnarfWorker
EOF

Any ideas why this does not return while beagle-shutdown does?

tia,
 Max




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]