3 # open-vm-tools Helper scripts for open-vm-tools
7 # description: Helper scripts for open-vm-tools
11 # Source function library.
12 . /etc/rc.d/init.d/functions
19 if [ ! -f /usr/bin/vmware-checkvm ] ; then
24 if /usr/bin/vmware-checkvm -p | grep -q ESX; then
31 # return true if $module exists for current kernel
34 test -f /lib/modules/$kver/misc/$module.ko*
38 # Check if the service is already running?
39 if [ -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
40 msg_already_running "Open Virtual Machine vmxnet script"
44 msg_starting "Open Virtual Machine vmxnet script"
46 if ! module_exist vmxnet; then
48 echo -e "\tCan't find vmxnet module"
53 for ethif in `ifconfig -a | grep ^eth | cut -d' ' -f1`; do
54 /sbin/ethtool -K $ethif tso on > /dev/null 2>&1
57 touch /var/lock/subsys/open-vm-tools-vmxnet
61 if [ ! -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
62 msg_not_running "Open Virtual Machine vmxnet script"
66 msg_stopping "Open Virtual Machine vmxnet script"
68 rm -f /var/lock/subsys/open-vm-tools-vmxnet
73 # vmblock is not required and unsupported on ESX so first check
74 # if it's installed then try to use
75 module_exist vmblock || return
77 # Check if the service is already running?
78 if [ -f /var/lock/subsys/open-vm-tools-vmblock ]; then
79 msg_already_running "Open Virtual Machine vmblock script"
83 _modprobe single vmblock
84 msg_starting "Open Virtual Machine vmblock script"
86 mkdir -p /tmp/VMwareDnD
87 chmod 1777 /tmp/VMwareDnD
88 mount -t vmblock none /proc/fs/vmblock/mountPoint
90 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmblock && ok && return
95 module_exist vmblock || return
97 if [ ! -f /var/lock/subsys/open-vm-tools-vmblock ]; then
98 msg_not_running "Open Virtual Machine vmblock script"
102 msg_stopping "Open Virtual Machine vmblock script"
104 umount /proc/fs/vmblock/mountPoint
106 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmblock && ok && return
111 # vmhgfs is not required and usupported on ESX so first check
112 # if it's installed then try to use
113 module_exist vmhgfs || return
115 # Check if the service is already running?
116 if [ -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
117 msg_already_running "Open Virtual Machine vmhgfs script"
121 _modprobe single vmhgfs
122 msg_starting "Open Virtual Machine vmhgfs script"
125 mount -t vmhgfs .host:/ /mnt/hgfs
127 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
132 module_exist vmhgfs || return
134 if [ ! -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
135 msg_not_running "Open Virtual Machine vmhgfs script"
139 msg_stopping "Open Virtual Machine vmhgfs script"
143 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
148 # Check if the service is already running?
149 if [ -f /var/lock/subsys/open-vm-tools-vmsync ]; then
150 msg_already_running "Open Virtual Machine vmsync script"
154 _modprobe single vmsync
155 msg_starting "Open Virtual Machine vmsync script"
156 daemon /usr/bin/vmtoolsd --background /var/run/vmtoolsd.pid
158 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmsync
162 if [ ! -f /var/lock/subsys/open-vm-tools-vmsync ]; then
163 msg_not_running "Open Virtual Machine vmsync script"
167 msg_stopping "Open Virtual Machine vmsync script"
168 killproc --pidfile vmtoolsd.pid vmtoolsd
169 rm -f /var/lock/subsys/open-vm-tools-vmsync
174 if is_no `is_ESX_running`; then
178 _modprobe single vmware_vmmemctl
179 _modprobe single vmci
180 _modprobe single vsock
181 _modprobe single vmw_pvscsi
192 # See how we were called.
205 msg_usage "$0 {start|stop|restart}"