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
18 if [ ! -f /usr/bin/vmware-checkvm ] ; then
23 if /usr/bin/vmware-checkvm -p | grep -q ESX; then
30 # return true if $module exists for current kernel
33 test -f /lib/modules/$kver/misc/$module.ko*
37 # Check if the service is already running?
38 if [ -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
39 msg_already_running "Open Virtual Machine vmxnet script"
43 msg_starting "Open Virtual Machine vmxnet script"
45 if ! module_exist vmxnet; then
47 echo -e "\tCan't find vmxnet module"
52 for ethif in `ifconfig -a | grep ^eth | cut -d' ' -f1`; do
53 /sbin/ethtool -K $ethif tso on > /dev/null 2>&1
56 touch /var/lock/subsys/open-vm-tools-vmxnet
60 if [ ! -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
61 msg_not_running "Open Virtual Machine vmxnet script"
65 msg_stopping "Open Virtual Machine vmxnet script"
67 rm -f /var/lock/subsys/open-vm-tools-vmxnet
72 # vmblock is not required and unsupported on ESX so first check
73 # if it's installed then try to use
74 module_exist vmblock || return
76 # Check if the service is already running?
77 if [ -f /var/lock/subsys/open-vm-tools-vmblock ]; then
78 msg_already_running "Open Virtual Machine vmblock script"
82 _modprobe single vmblock
83 msg_starting "Open Virtual Machine vmblock script"
85 mkdir -p /tmp/VMwareDnD
86 chmod 1777 /tmp/VMwareDnD
87 mount -t vmblock none /proc/fs/vmblock/mountPoint
89 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmblock && ok && return
94 module_exist vmblock || return
96 if [ ! -f /var/lock/subsys/open-vm-tools-vmblock ]; then
97 msg_not_running "Open Virtual Machine vmblock script"
101 msg_stopping "Open Virtual Machine vmblock script"
103 umount /proc/fs/vmblock/mountPoint
105 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmblock && ok && return
110 # vmhgfs is not required and usupported on ESX so first check
111 # if it's installed then try to use
112 module_exist vmhgfs || return
114 # Check if the service is already running?
115 if [ -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
116 msg_already_running "Open Virtual Machine vmhgfs script"
120 _modprobe single vmhgfs
121 msg_starting "Open Virtual Machine vmhgfs script"
124 mount -t vmhgfs .host:/ /mnt/hgfs
126 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
131 module_exist vmhgfs || return
133 if [ ! -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
134 msg_not_running "Open Virtual Machine vmhgfs script"
138 msg_stopping "Open Virtual Machine vmhgfs script"
142 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
147 # Check if the service is already running?
148 if [ -f /var/lock/subsys/open-vm-tools-vmsync ]; then
149 msg_already_running "Open Virtual Machine vmsync script"
153 _modprobe single vmsync
154 msg_starting "Open Virtual Machine vmsync script"
155 daemon /usr/bin/vmtoolsd --background /var/run/vmtoolsd.pid
157 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmsync
161 if [ ! -f /var/lock/subsys/open-vm-tools-vmsync ]; then
162 msg_not_running "Open Virtual Machine vmsync script"
166 msg_stopping "Open Virtual Machine vmsync script"
167 killproc --pidfile vmtoolsd.pid vmtoolsd
168 rm -f /var/lock/subsys/open-vm-tools-vmsync
173 if is_no `is_ESX_running`; then
177 _modprobe single vmware_vmmemctl
178 _modprobe single vmci
179 _modprobe single vsock
180 _modprobe single vmw_pvscsi
191 # See how we were called.
204 msg_usage "$0 {start|stop|restart}"