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

Re: Summary: logout/halt/reboot as ordinary user, gnome logout button?



On Tue, 14 Dec 1999 ressu@uusikaupunki.fi wrote:

> the shutdown button could be an external program, just like xbanner
> changes the background, some other program could run like xbanner and
> start when xdm/gdm starts and make a button, and die after the
> login...

Ever since I brough this up here a couple of years ago, I've used this
simple incantion in /etc/X11/xdm/Xsetup_0:

pear# cat /etc/X11/xdm/Xsetup_0
#!/bin/sh
# $XConsortium: Xsetup_0,v 1.3 93/09/28 14:30:31 gildea Exp $

if grep -q ^run-xconsole /etc/X11/config; then
  xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed \
    -exitOnFail -file /dev/xconsole
fi

touch /var/run/xdm.ok._0

# reboot button
/usr/bin/wish <<EOF &
  wm geometry . +0-0
  button .halt   -text Halt   -command {exec shutdown -h now}
  button .reboot -text Reboot -command {exec shutdown -r now}
  pack .halt .reboot -side left
EOF
  echo $! > /var/run/xdmbutton_0.pid


Then Xstartup kills them:

pear# cat /etc/X11/xdm/Xstartup_0
#!/bin/sh
#
# This script is run as root after a user starts a session on :0.

set -e

# Call the global Xstartup script, if it exists
if [ -x /etc/X11/xdm/Xstartup ]; then
  /etc/X11/xdm/Xstartup
fi

# This bit doesn't matter, so set +e
set +e

# :0 specific startup commands go here
# reboot button
for i in /var/run/xdm*_0.pid; do
    kill `cat $i`
    rm $i
done;

exit 0

Jules


/----------------+-------------------------------+---------------------\
|  Jelibean aka  | jules@jellybean.co.uk         |  6 Evelyn Rd	       |
|  Jules aka     | jules@debian.org              |  Richmond, Surrey   |
|  Julian Bean   | jmlb2@hermes.cam.ac.uk        |  TW9 2TF *UK*       |
+----------------+-------------------------------+---------------------+
|  War doesn't demonstrate who's right... just who's left.             |
|  When privacy is outlawed... only the outlaws have privacy.          |
\----------------------------------------------------------------------/


Reply to: