Force user logout?

Kurt Granroth plug-discuss at granroth.org
Sun Feb 19 17:51:49 MST 2006


On Feb 19, 2006, at 7:22 AM, Alan Dayley wrote:
>> If you want the processes to actually perform a logout procedure and
>> your son is running KDE, then try this:
>>
>> # dcop --all-sessions --all-users ksmserver ksmserver logout 0 2 0
>
> OK, this appears to have worked well except that it resulted in a
> shutdown of the the system.  This is not bad, I was just originally
> looking for a way to logout but not shutdown.  I'll go investigate  
> dcop
> commands.

Oops, I thought that that was your intent.  You said, and I quote: "I  
want to force the user to logout so the machine can cleanly  
shutdown."  My bad for not giving  a full description of what is  
going to happen. :-)

Basically, there are three options to logout.  The first is  
effectively a boolean like 'ask_for_confirmation' where 0 means don't  
ask and 1 (or any positive, actually) means to ask.  The second  
option is based off of KApplication::ShutdownType.  0 = logout, 1 =  
reboot, 2 = shutdown.  I don't remember exactly what the third  
parameter is for.  I've never used it.  I think it has to do with how  
much interaction you allow the user during the logout process... but  
I could be wrong.

So, some possibilities:

ksmserver logout 1 0 0  => start a logout but allow the user to  
cancel it ("Are you sure?")
ksmserver logout 0 0 0 => logout immediately
ksmserver logout 1 1 0 => start a reboot but allow the user to cancel
ksmserver logout 0 2 0 => shutdown immediately

The latter two require that the KDE session has started via KDM (or  
possibly gdm).  If it's started by 'startx', then only the logout  
option works.

Kurt


More information about the PLUG-discuss mailing list