Menu

[r10367]: / legacy / etc / rc.d / vmguestd  Maximize  Restore  History

Download this file

98 lines (85 with data), 1.8 kB

#!/bin/sh
# Copyright (C) 2010 FreeNAS project.

# PROVIDE: vmguestd
# REQUIRE: DAEMON
# BEFORE: LOGIN

. /etc/rc.subr
. /etc/util.subr

name="vmguestd"
rcvar=`set_rcvar`
load_rc_config "${name}"

start_cmd="vmguestd_start"
stop_cmd="vmguestd_stop"

# default
vmguestd_enable=${vmguestd_enable:="YES"}
pidfile="/var/run/${name}.pid"

vmware_guestd_start()
{
    command=/usr/local/bin/vmtoolsd
    if [ ! -x $command ]; then
	return;
    fi
    command_args="-c /usr/local/share/vmware-tools/tools.conf"
    command_args="$command_args -p /usr/local/lib/open-vm-tools/plugins/vmsvc"
    command_args="$command_args --background ${pidfile}"
    unset start_cmd stop_cmd
    run_rc_command "start"
}

vmware_guestd_stop()
{
    command=/usr/local/bin/vmtoolsd
    if [ ! -x $command ]; then
	return;
    fi
    unset start_cmd stop_cmd
    run_rc_command "stop"
}

vbox_guestd_start()
{
    command=/usr/local/sbin/VBoxService
    if [ ! -x $command ]; then
	return;
    fi
    command_args="--enable-timesync"
    command_args="$command_args --disable-vminfo"
    unset start_cmd stop_cmd
    pidfile=
    procname=$command
    run_rc_command "start"
}

vbox_guestd_stop()
{
    command=/usr/local/sbin/VBoxService
    if [ ! -x $command ]; then
	return;
    fi
    unset start_cmd stop_cmd
    pidfile=
    procname=$command
    run_rc_command "stop"
}

vmguestd_start()
{
    local _vmtype
    _vmtype=`get_vmtype`
    if [ "$_vmtype" = "vmware" ]; then
	eval "vmware_guestd_start"
    elif [ "$_vmtype" = "vbox" ]; then
	eval "vbox_guestd_start"
    else
	:
    fi
}

vmguestd_stop()
{
    local _vmtype
    _vmtype=`get_vmtype`
    if [ "$_vmtype" = "vmware" ]; then
	eval "vmware_guestd_stop"
    elif [ "$_vmtype" = "vbox" ]; then
	eval "vbox_guestd_stop"
    else
	:
    fi
}

run_rc_command "$1"
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.