Hello,<br><br>I am working on a fairly well-known ongoing problem where you have a slow logoff if connected wirelessly to a Samba share.<br>You get the message 'CIFS VFS: No response ...' and it takes about 2 minutes for the laptop to shutdown.<br>
Apparently it happens because Network Manager closes down before the CIFS mounts are unmounted.<br><br>It will probably be some time before this gets fixed at the root cause but there is a good work-around for Gnome.<br>It entails running a process in the Gnome session that waits for the 'save-yourself' event (see below).<br>
<br>Is there a similar closing-down event that can be hooked into with an XFCE session ?<br>Would anyone be able to supply the few lines of code required in main() below ?<br>I could then test and, if successful, post the solution back into the Ubuntu forums article below.  <br>
<br>#!/usr/bin/env python<br><br>#Author: Seamus Phelan<br># <a href="http://ubuntuforums.org/showthread.php?p=8451352#post8451352">http://ubuntuforums.org/showthread.php?p=8451352#post8451352</a><br><br>#This program runs a custom command/script just before gnome shuts <br>
#down.  This is done the same way that gedit does it (listening for <br>#the 'save-yourself' event).  This is different to placing scipts <br>#in /etc/rc#.d/ as the script will be run before gnome exits.<br>#If the custom script/command fails with a non-zero return code, a <br>
#popup dialog box will appear offering the chance to cancel logout<br>#<br>#Usage: 1 - change the command in the 'subprocess.call' in <br>#           function 'session_save_yourself' below to be what ever<br>
#           you want to run at logout.<br>#       2 - Run this program at every gnome login (add via menu System <br>#           -> Preferences -> Session)<br># <br>#<br><br>import sys<br>import subprocess<br>import datetime<br>
<br>import gnome<br>import gnome.ui<br>import gtk<br><br>class Namespace: pass<br>ns = Namespace()<br>ns.dialog = None<br><br>def main():<br>    prog = gnome.init ("gnome_save_yourself", "1.0", gnome.libgnome_module_info_get(), sys.argv, [])<br>
    client = gnome.ui.master_client()<br>    #set up call back for when 'logout'/'Shutdown' button pressed<br>    client.connect("save-yourself", session_save_yourself)<br>    client.connect("shutdown-cancelled", shutdown_cancelled)<br>
<br>def session_save_yourself( *args):<br>    #Unmount those CIFS shares!<br>    retcode = subprocess.call("sudo /etc/init.d/umountnfs.sh", shell=True)<br>    if retcode != 0:<br>        #command failed  <br>        show_error_dialog()<br>
    return True<br><br>def shutdown_cancelled( *args):<br>    if ns.dialog != None:<br>        ns.dialog.destroy()<br>    return True<br><br>def show_error_dialog():<br>    ns.dialog = gtk.Dialog("There was a problem running your pre-shutdown script",<br>
                           None,<br>                           gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,<br>                           ("There was a problem running your pre-shutdown script - continue logout", gtk.RESPONSE_ACCEPT))<br>
    if ns.test_mode == True:<br>        response = ns.dialog.run()<br>        ns.dialog.destroy()<br>    else:<br>        #when in shutdown mode gnome will only allow you to open a window using master_client().save_any_dialog()<br>
        #It also adds the 'Cancel logout' button<br>        gnome.ui.master_client().save_any_dialog(ns.dialog)<br><br>#Find out if we are in test mode???<br>if len(sys.argv) >=2 and sys.argv[1] == "test":<br>
    ns.test_mode = True<br>else:<br>    ns.test_mode = False<br><br>if ns.test_mode == True:<br>    main()<br>    session_save_yourself()<br>else:<br>    main()<br>    gtk.main()<br><br>Regards,<br>David Collins<br><br>