Re: [gdm-list] GDM Connection



Flavius:

Hello, I am working on an application that shuts down the computer after
a specified period of time. If I were to use the system halt command, I
would need a password so that the user executing it would have
administrative privileges. I want to avoid this, do it just like the
GNOME Quit applet does, but I don't understand how to set up a
connection to GDM and what message should I send. Please help me if you
know ;) Thank you

GDM doesn't really provide a feature that "shuts down the system now"
unless you pick shutdown from the login screen itself.

When you tell GDM to shut down the machine from a running session,
it works like this:

Note the gdmflexiserver --command="SET_LOGOUT_ACTION=action"
or "SET_SAFE_LOGOUT_ACTION=action" commands.  The "action" word can
be HALT to shutdown the machine or REBOOT to reboot the machine or
SUSPEND to suspend the machine.  For these to work, the GDM
configuration has to be properly set up with the right halt, shutdown,
and reboot commands.  These should be setup okay by your OS, but
if you have special things you want to run at shutdown time you
might want to configure GDM to run your own script that does
cleanup and then shuts down the machine.  If you want to avoid
using the gdmflexiserver program you can interact with the GDM
sockets pipe directly.  Some programs like to do this since it is perhaps
a tiny bit faster.  Note the gnome-panel and Fast-User-Switch
applet if you want to see examples of code doing things this way.

However, these will shutdown the machine as follows:

- SET_LOGOUT_ACTION - waits until the user who made the LOGOUT_ACTION
  request logs out and then performs the action.

- SET_SAFE_LOGOUT_ACTION - waits until all users have logged out
  and then performs the action.

So, the actions don't take effect until the user logs out.  You
could perhaps use SET_LOGOUT_ACTION and then have your script kill
your session, and this would trigger the shutdown.

For more info, check out the GDM documentation at:

   http://www.gnome.org/projects/gdm/docs.html

Brian






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