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 # vmblock is not required and unsupported on ESX so first check
38 # if it's installed then try to use
39 module_exist vmblock || return
41 # Check if the service is already running?
42 if [ -f /var/lock/subsys/open-vm-tools-vmblock ]; then
43 msg_already_running "Open Virtual Machine vmblock script"
47 _modprobe single vmblock
48 msg_starting "Open Virtual Machine vmblock script"
50 mkdir -p /tmp/VMwareDnD
51 chmod 1777 /tmp/VMwareDnD
52 mount -t vmblock none /proc/fs/vmblock/mountPoint
54 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmblock && ok && return
59 module_exist vmblock || return
61 if [ ! -f /var/lock/subsys/open-vm-tools-vmblock ]; then
62 msg_not_running "Open Virtual Machine vmblock script"
66 msg_stopping "Open Virtual Machine vmblock script"
68 umount /proc/fs/vmblock/mountPoint
70 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmblock && ok && return
75 # vmhgfs is not required and usupported on ESX so first check
76 # if it's installed then try to use
77 module_exist vmhgfs || return
79 # Check if the service is already running?
80 if [ -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
81 msg_already_running "Open Virtual Machine vmhgfs script"
85 _modprobe single vmhgfs
86 msg_starting "Open Virtual Machine vmhgfs script"
89 mount -t vmhgfs .host:/ /mnt/hgfs
91 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
96 module_exist vmhgfs || return
98 if [ ! -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
99 msg_not_running "Open Virtual Machine vmhgfs script"
103 msg_stopping "Open Virtual Machine vmhgfs script"
107 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
112 # Check if the service is already running?
113 if [ -f /var/lock/subsys/open-vm-tools-vmsync ]; then
114 msg_already_running "Open Virtual Machine vmsync script"
118 msg_starting "Open Virtual Machine vmsync script"
119 daemon /usr/bin/vmtoolsd --background /var/run/vmtoolsd.pid
121 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmsync
125 if [ ! -f /var/lock/subsys/open-vm-tools-vmsync ]; then
126 msg_not_running "Open Virtual Machine vmsync script"
130 msg_stopping "Open Virtual Machine vmsync script"
131 killproc --pidfile vmtoolsd.pid vmtoolsd
132 rm -f /var/lock/subsys/open-vm-tools-vmsync
136 if is_no `is_ESX_running`; then
140 _modprobe single vmware_vmmemctl
141 _modprobe single vmw_vmci
142 _modprobe single vsock
152 # See how we were called.
165 msg_usage "$0 {start|stop|restart}"