Re: [gdm-list] GDM session shutdown - how to execute an script before apps are killed.

Thanks Dan & Brian,

   The reason I need this is quite trivial that's why I didn't mention it 

   In my home desktop, I have a startup script that automatically runs
azureus which is a java application, and leaves it running minimized as a
tray icon. I use Ubuntu Feisty (although the same annoying problem has been
happening in all distros I used, since years ago).

   When I shutdown the machine using the regular gnome's System > Quit, if I
don't manually close azureus, then the next time I turn on the machine,
azureus will complain with an error message that "it was not tidily
shutdown". I asked the azureus guys, they told me that to programatically
and "tidily" shutdown their app I can use "killall -SIGHUP java", which
works fine when executed *within the session*. I've been seeing this error
message for like 2 or 3 years now, and now I want to get rid of it :)  

(there are reasons I can't replace azureus with other BT clients, and why I
need to automate the loading)

   So I've been asking around again and again and came to various
suggestions, all around the /etc/rc.d and /etc/init.d/gdm  scripts, with
which I played, and that helped me to realize those were executed after the
gnome session  was over.

   Dan: your suggestion looks promising and I will give a try later today... 


Dan Nicholson-2 wrote:
> On 5/10/07, Ari El <ari reads gmail com> wrote:
>> I need to automate the execution a command (killall -SIGHUP java) when my
>> GDM session closes (session logout), but *before* GDM kills all my active
>> session applications upon logout.
>> I've been playing with /etc/init.d/gdm and added my command line in the
>> "stop" code section, and this does get executed, but after my gdm session
>> is
>> closed, so it didn't help.
>> I also played with the "PostSession" scripts, but then again, these are
>> executed after all active user apps have been killed.
> So, you really need to run this killall before gnome-session ends and
> it's not OK to run them in PostSession? Why is that, out of curiosity?
> I don't think gdm can control that situation, then. It just waits for
> gnome-session to return before continuing its duties. And, as far as I
> know, there isn't a way to configure logout actions in gnome-session.
> It might be possible to make a wrapper script for this java app that
> signals it with SIGHUP when it receives SIGTERM. I don't know if that
> helps this situation, though. Something like
> #!/bin/sh
> trap 'killall -SIGHUP java' TERM
> java ...
> Since I think it will be sent TERM when gnome-session is trying to end.
> --
> Dan
> _______________________________________________
> gdm-list mailing list
> gdm-list gnome org

View this message in context:
Sent from the Gdm-list mailing list archive at

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