Pre-Logout Script

Erik Habicht erik.habicht at gmail.com
Sun Nov 18 20:17:12 CET 2012


On 18.11.2012 20:04, houghi wrote:
> On Sun, Nov 18, 2012 at 06:57:18PM +0100, Erik Habicht wrote:
>> thank you for your research and the simple working solution. I tried it
>> out and it works as expected. But i implement it a little bit different.
>> Instead of moving the /usr/bin/xfce4-session to
>> /usr/bin/xfce4-session.orig i add a /usr/local/bin/xfce4-session that
>> invoke /usr/bin/xfce4-session.
> That is better as renaming and moving default stuff around is not such a
> good idea.
>
>> In the meantime i worked out another solution. It's the more native way,
>> but not so simple. I add a system call to xfce4-session/xfsm-manager.c
>> that runs 'run-parts /etc/xfce/pre-logout.d'. The patch is not ready for
>> production but it works.
>> I think running a shell script as you said instead of use run-parts
>> could be the better solution since run-parts is not part of all
>> distribution.
> openSUSE does not have it.
>
>> This is the code that runs pre logout:
>>
>> killall -TERM vmplayer
> Doesn't vmplayer have a native command to do just that? I do not use
> vmplayer as I use VirtualBox, so I have no idea if it is possible.
The offered script already works well with vmplayer. And if you uncheck 
'Confirm before closing a virtual machine' you get rid of the asking 
Dialog. I don't know a native way. vmrun is not part of my vmplayer 
installation. Maybe it is only packaged in the windows binary.
>
>  From what I found a good place to start is `vmrun -T player list`, find
> the vmx('s) that are running and then in a loop kill them. e.g.
>
> for I in `vmrun -T player list|<something to get the vmx full path>`
> do
> 	vmrun stop $I
> done
>
> Obviously this might take a bit more time then just killing it, but it
> might also prevent problems with VM when you just kill it. You could also
> suspend it instead of stopping it:
> http://www.vmware.com/support/ws5/doc/ws_learning_cli_vmrun.html
> gives more info.
>
> Under Virtualbox this would be:
> for I in `VBoxManage list -l runningvms|grep ^UUID|awk '{print $NF}'`
> do
> 	VBoxManage controlvm $I poweroff
> done
>
> houghi



More information about the Xfce mailing list