vboxballoonctrl-service.sh revision d6c844c7fb61f8dcbb4a36d0cdfbb70654a8a7ed
#
# VirtualBox balloon control daemon init script.
#
# Copyright (C) 2006-2012 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# chkconfig: 35 35 65
# description: VirtualBox balloon control daemon
#
### BEGIN INIT INFO
# Provides: vboxballoonctrl-service
# Required-Start: vboxdrv
# Required-Stop: vboxdrv
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: VirtualBox balloon control daemon
### END INIT INFO
if [ -n "$INSTALL_DIR" ]; then
binary="$INSTALL_DIR/VBoxBalloonCtrl"
else
fi
# silently exit if the package was uninstalled but not purged,
# applies to Debian packages only (but shouldn't hurt elsewhere)
if [ -f /etc/redhat-release ]; then
elif [ -f /etc/SuSE-release ]; then
elif [ -f /etc/debian_version ]; then
elif [ -f /etc/gentoo-release ]; then
elif [ -f /etc/arch-release ]; then
elif [ -f /etc/slackware-version ]; then
elif [ -f /etc/lfs-release ]; then
else
fi
fi
if [ -z "$NOLSB" ]; then
echo ""
log_failure_msg "$1"
}
log_success_msg " done."
}
log_daemon_msg "$@"
}
fi
if [ "$system" = "redhat" ]; then
if [ -n "$NOLSB" ]; then
usr="$1"
shift
}
echo
}
echo
}
echo -n "$1"
}
fi
fi
if [ "$system" = "suse" ]; then
usr="$1"
shift
}
if [ -n "$NOLSB" ]; then
rc_status -v
}
rc_status -v
}
echo -n "$1"
}
fi
fi
if [ "$system" = "debian" ]; then
usr="$1"
shift
bin="$1"
shift
}
}
if [ -n "$NOLSB" ]; then
echo " ...fail!"
}
echo " ...done."
}
echo -n "$1"
}
fi
fi
if [ "$system" = "gentoo" ]; then
if [ -f /sbin/functions.sh ]; then
. /sbin/functions.sh
fi
usr="$1"
shift
bin="$1"
shift
}
}
if [ -n "$NOLSB" ]; then
echo " ...fail!"
}
echo " ...done."
}
echo -n "$1"
}
shift
fi
fi
fi
if [ "$system" = "arch" ]; then
usr="$1"
shift
test $? -eq 0 && add_daemon rc.`basename $2`
}
killall $@
}
if [ -n "$NOLSB" ]; then
}
}
stat_busy "$1"
}
fi
fi
if [ "$system" = "slackware" ]; then
killall $1
}
if [ -n "$NOLSB" ]; then
echo " ...fail!"
}
echo " ...done."
}
echo -n "$1"
}
fi
usr="$1"
shift
}
fi
if [ "$system" = "lfs" ]; then
if [ -n "$NOLSB" ]; then
}
}
echo $1
}
fi
usr="$1"
shift
}
statusproc $1
}
fi
if [ "$system" = "other" ]; then
if [ -n "$NOLSB" ]; then
echo " ...fail!"
}
echo " ...done."
}
echo -n "$1"
}
fi
fi
}
if [ -n "$2" ]; then
fail_msg "VBOXBALLOONCTRL_USER must not contain multiple users!"
exit 1
fi
}
if ! test -f $PIDFILE; then
vboxdrvrunning || {
fail_msg "VirtualBox kernel module not loaded!"
exit 0
}
PARAMS="--background"
[ -n "$VBOXBALLOONCTRL_LOWERLIMIT" ] && PARAMS="$PARAMS --balloon-lower-limit $VBOXBALLOONCTRL_LOWERLIMIT"
# prevent inheriting this setting to VBoxSVC
unset VBOX_RELEASE_LOG_DEST
# ugly: wait until the final process has forked
sleep .1
RETVAL=0
else
RETVAL=1
fi
fi
return $RETVAL
}
stop() {
if test -f $PIDFILE; then
RETVAL=$?
else
fi
fi
return $RETVAL
}
stop && start
}
echo -n "Checking for VBox balloon control service"
if [ -f $PIDFILE ]; then
echo " ...running"
else
echo " ...not running"
fi
}
case "$1" in
;;
stop)
stop
;;
;;
;;
;;
;;
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL