#!/bin/sh # # virtualbox VirtualBox virtualizer for x86 hardware # chkconfig: 345 84 16 # description: Oracle VirtualBox is a general-purpose full virtualizer for x86 \ # hardware. Targeted at server, desktop and embedded use. # Source function library . /etc/rc.d/init.d/functions VBOX_MODULE="vboxsf" # Get service config - may override defaults [ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox start() { if [ -f /var/lock/subsys/vboxsf ]; then return fi modprobe -s $VBOX_MODULE touch /var/lock/subsys/vboxsf } stop() { # umount vboxsf mounts, no retry, just don't stack them :) local mount errors out rc=0 show "Unmounting vboxsf file systems"; busy awk '$3 == "vboxsf" {print $2}' /proc/mounts | while read mount; do if ! umount "$mount"; then rc=$? fi done if [ $rc = 0 ]; then ok else fail fi # NOTE: rmmod will say module in use if there are remaining mounts /sbin/rmmod $VBOX_MODULE rm -f /var/lock/subsys/vboxsf } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) if ! is_module $VBOX_MODULE; then echo "$VBOX_MODULE module is loaded" else echo "$VBOX_MODULE module is not loaded" RETVAL=3 fi ;; *) msg_usage "$0 {start|stop|restart|status}" exit 3 esac exit $RETVAL