need to run a shutdown script
Chris G
cl at isbd.net
Thu Jul 30 12:35:37 CEST 2009
On Thu, Jul 30, 2009 at 12:15:24PM +0200, Christoph Wickert wrote:
> Am Mittwoch, den 29.07.2009, 17:51 -0500 schrieb toddandmargo:
>
> > okay. I give up. I have searched and searched. I need to run a
> > shutdown script to turn off all my virtual machines before xfce 4.4.2
> > starts its shutdown sequence. I will provide the script. I just
> > need the directions as to where to put the script. How does one
> > configure a shutdown script?
>
> Why do your virtual machines depend on an x-session?
>
Because they are started as a GUI process under X, hence when you shut
X down they get killed which isn't very good for the virtual machines.
I hit *exactly* this problem and I have a bodge which I have added to
the file ~/.config/xfce4/xinitrc. This is the file that (sort of)
starts and stops the xfce4 session and you can add things to happen
before and after the X GUI. The relevant bit from my xinitrc is:-
# Use ssh-agent if installed and not already running. Run it separately
# so it populates the environment here, so we can clean it up later.
# Don't use ssh-agent if it has been disabled in Xsession.options
if grep -qs ^use-ssh-agent "/etc/X11/Xsession.options"; then
sshagent=`which ssh-agent`
kill_sshagent=0
if test -z "$SSH_AGENT_PID" -a "$sshagent" -a "x$sshagent" != "xno"; then
eval `$sshagent -s`
kill_sshagent=1
fi
fi
#
#
# My additions to run stuff on the desktop
#
/home/chris/bin/xstartup
# 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
#
#
# My additions to close X applications down
#
/home/chris/bin/xshutdown
exit 0
;;
esac
##################
# IMPORTANT NOTE #
##################
# Everything below here ONLY gets executed if you are NOT using xfce4-session
# (Xfce's session manager). If you are using the session manager, everything
# below is handled by it, and the code below is not executed at all.
If you're
# not sure if you're using the session manager, type 'ps -e|grep xfce4-session'
# in a terminal while Xfce is running.
##################
Then I add what I need in /home/chris/bin/xstartup and /home/chris/bin/xshutdown.
Specifically in /home/chris/bin/xshutdown I have:-
VBoxManage controlvm 'XP MKIII' savestate
Which saves the virtual machine and only returns (so that the X
shutdown continues) when the save has completed.
I would prefer a 'proper' method of adding stuff like this but there
doesn't appear to be one.
--
Chris Green
More information about the Xfce
mailing list