[PATCH GDM] xterminals can shutdown automatically



Hello,

The GDM System Menu offers some features:
 - reboot
 - halt

But these features are currently not available in GDM when we use XDMCP
with xterminals. I'm pleased to send you a patch that make it possible.

Two new settings are in the gdm.conf file:
RemoteRebootCommand=/usr/bin/gdm-remote-shutdown reboot %d
RemoteHaltCommand=/usr/bin/gdm-remote-shutdown halt %d

When the user choose "Halt", GDM either calls the command "HaltCommand"
or "RemoteHaltCommand": it checks d->console in order to know if GDM
display is local or remote.

When calling RemoteHaltCommand, the "%d" is replaced by the display name
found in d->name.

/usr/bin/gdm-remote-shutdown may use SSH. I use SSH keys with an empty
password because this script is not interactive.

---8<---8<---8<---8<---8<---
#!/bin/bash

echo $1 $2 >> /tmp/gdm_remote.txt #Debug...

if [ "$1" = "halt" ] ; then
        IP=`echo $2 | cut -f1 -d:`
        /usr/bin/ssh $IP halt
fi

if [ "$1" = "reboot" ] ; then
        IP=`echo $2 | cut -f1 -d:`
        /usr/bin/ssh $IP reboot
fi
---8<---8<---8<---8<---8<---

My tests show it works: if I select shutdown in GDM on the server, the
server execute "HaltCommand" and halts. If I select shutdown in GDM on a
xterminal, the server execute "RemoteHaltCommand" and the xterminal
halts.

Please let me know what you think about this feature. If this doesn't
work with you, mail me.

-- 
Alban Crequy
Révolution Linux http://www.revolutionlinux.com/


Attachment: gdm-2.4.4.7-non-local-action.patch.bz2
Description: Binary data

#!/bin/bash

echo $1 $2 >> /tmp/gdm_remote.txt

if [ "$1" = "halt" ] ; then
	IP=`echo $2 | cut -f1 -d:`
	/usr/bin/ssh $IP halt
fi

if [ "$1" = "reboot" ] ; then
	IP=`echo $2 | cut -f1 -d:`
	/usr/bin/ssh $IP reboot
fi



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