On Mon, Feb 23, 2009 at 10:18:23PM +0000, Chris G wrote:
I run xubuntu 8.10 and I want to shut down my VirtualBox guest machine when I log out. That is I want to shut it down automatically, I usually remember to do it before I logout but sometimes I forget and it is then shut down 'ungracefully' with risk to its contents.
One would have thought that there would be 'hooks' for running stuff at shutdown but I can't find any at all.
Does anyone have any suggestions?
Well I've found the answer, in fact the answer to this and many of my other 'problems' with xfce.
If you put a file called xinitrc in $HOME/.config/xfce4 it is executed in preference to the default /etc/xdg/xfce4/xinitrc.
So all I need to do to get my hearts desire of a *script* to start all my programs and also a place to do things when logging out from X is to copy /etc/xdg/xfce4/xinitrc to $HOME/.config/xfce4 and then modify that script.
In fact it's very easy to find where to put things to run 'before' and 'after', you put them either side of running the xfce4 session manager. I.e. in an extract from xinitrc :-
echo "XXX: About to start xfce4-session" # Run xfce4-session if installed xfcesm=`which xfce4-session` case "x$xfcesm" in x|xno*) ;; *) $xfcesm
if test $kill_sshagent -eq 1; then eval `$sshagent -k` fi echo "XXX: Returned from xfce4-session" exit 0 ;; esac
The two echo lines are executed exactly at the times I want and appear in .xsession-errors. There are various possibilities for doing this more neatly like a wrapper round xfce4-session but for the moment just editing the xinitrc will do me fine.
Why didn't anyone tell me about this - it's satisfied nearly all my problems with xfce4.