def linux_shutdown():
 if (not HAVE_DBUS):
  os._exit(0)
 (proxy, interface) = _get_sessionproxy()
 if proxy:
  if proxy.CanShutdown():
   proxy.Shutdown(dbus_interface=interface)
 else:
  (proxy, interface, _pinterface) = _get_systemproxy('ConsoleKit')
  if proxy:
   if proxy.CanStop(dbus_interface=interface):
    try:
     proxy.Stop(dbus_interface=interface)
    except dbus.exceptions.DBusException as msg:
     logging.info('Received a DBus exception %s', msg)
  else:
   logging.info('DBus does not support Stop (shutdown)')
 os._exit(0)

def linux_shutdown ( ) : if ( not HAVE_DBUS ) : os . _exit ( 0 ) ( proxy , interface ) = _get_sessionproxy ( ) if proxy : if proxy . CanShutdown ( ) : proxy . Shutdown ( dbus_interface = interface ) else : ( proxy , interface , _pinterface ) = _get_systemproxy ( 'ConsoleKit' ) if proxy : if proxy . CanStop ( dbus_interface = interface ) : try : proxy . Stop ( dbus_interface = interface ) except dbus . exceptions . DBusException as msg : logging . info ( 'Received a DBus exception %s' , msg ) else : logging . info ( 'DBus does not support Stop (shutdown)' ) os . _exit ( 0 )
make linux system shutdown .