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?
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.
On Mon, 2009-02-23 at 22:18 +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?
Glad to see from the other thread that you have found the answer to your own question.
On a related note though does VirtualBox support VNC? If it does there is another mode of operation in which existing from X doesn't forcibly kill the guest but leaves it running in such a way that you can reattach to it later and continue working. This can be good if you want to avoid a guest reboot cycle if you have to exit X and restart it for some reason.
Regards, Steve.
On Mon, Feb 23, 2009 at 11:47:06PM +0000, Steve Fosdick wrote:
On Mon, 2009-02-23 at 22:18 +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?
Glad to see from the other thread that you have found the answer to your own question.
On a related note though does VirtualBox support VNC? If it does there is another mode of operation in which existing from X doesn't forcibly kill the guest but leaves it running in such a way that you can reattach to it later and continue working. This can be good if you want to avoid a guest reboot cycle if you have to exit X and restart it for some reason.
VirtualBox cab be run 'headless' (VRDP mode I think it's called) and then used remotely from other machines. The intent behind this is to have a headless 'server' machine on which several VirtualBox guests can be run and then people use them as they need from other machines.
Is this the sort of setup you were meaning?