is_ESX_running() {
if [ ! -f /usr/bin/vmware-checkvm ] ; then
- echo no
- return
+ echo no
+ return
fi
if /usr/bin/vmware-checkvm -p | grep -q ESX; then
- echo yes
+ echo yes
else
- echo no
+ echo no
fi
}
start_vmxnet() {
# Check if the service is already running?
- if [ ! -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
- msg_starting "Open Virtual Machine vmxnet script"
- busy
- if is_no `module_exist vmxnet`; then
- fail
- echo -e "\tCan't find vmxnet module"
- RETVAL=1
- return
- fi
-
- for ethif in `ifconfig -a | grep ^eth | cut -d' ' -f1`; do
- /sbin/ethtool -K $ethif tso on > /dev/null 2>&1
- done
- ok
- touch /var/lock/subsys/open-vm-tools-vmxnet
- else
+ if [ -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
msg_already_running "Open Virtual Machine vmxnet script"
+ return
+ fi
+
+ msg_starting "Open Virtual Machine vmxnet script"
+ busy
+ if is_no `module_exist vmxnet`; then
+ fail
+ echo -e "\tCan't find vmxnet module"
+ RETVAL=1
+ return
fi
+
+ for ethif in `ifconfig -a | grep ^eth | cut -d' ' -f1`; do
+ /sbin/ethtool -K $ethif tso on > /dev/null 2>&1
+ done
+ ok
+ touch /var/lock/subsys/open-vm-tools-vmxnet
}
stop_vmxnet() {
- if [ -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
- msg_stopping "Open Virtual Machine vmxnet script"
- busy
- rm -f /var/lock/subsys/open-vm-tools-vmxnet
- ok
- else
+ if [ ! -f /var/lock/subsys/open-vm-tools-vmxnet ]; then
msg_not_running "Open Virtual Machine vmxnet script"
+ return
fi
+
+ msg_stopping "Open Virtual Machine vmxnet script"
+ busy
+ rm -f /var/lock/subsys/open-vm-tools-vmxnet
+ ok
}
start_vmblock() {
is_no `module_exist vmblock` && return
# Check if the service is already running?
- if [ ! -f /var/lock/subsys/open-vm-tools-vmblock ]; then
- _modprobe single vmblock
- msg_starting "Open Virtual Machine vmblock script"
- busy
- mkdir -p /tmp/VMwareDnD
- chmod 1777 /tmp/VMwareDnD
- mount -t vmblock none /proc/fs/vmblock/mountPoint
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmblock && ok && return
- fail
- else
+ if [ -f /var/lock/subsys/open-vm-tools-vmblock ]; then
msg_already_running "Open Virtual Machine vmblock script"
+ return
fi
+
+ _modprobe single vmblock
+ msg_starting "Open Virtual Machine vmblock script"
+ busy
+ mkdir -p /tmp/VMwareDnD
+ chmod 1777 /tmp/VMwareDnD
+ mount -t vmblock none /proc/fs/vmblock/mountPoint
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmblock && ok && return
+ fail
}
stop_vmblock() {
is_no `module_exist vmblock` && return
- if [ -f /var/lock/subsys/open-vm-tools-vmblock ]; then
- msg_stopping "Open Virtual Machine vmblock script"
- busy
- umount /proc/fs/vmblock/mountPoint
- RETVAL=$?
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmblock && ok && return
- fail
- else
+ if [ ! -f /var/lock/subsys/open-vm-tools-vmblock ]; then
msg_not_running "Open Virtual Machine vmblock script"
+ return
fi
+
+ msg_stopping "Open Virtual Machine vmblock script"
+ busy
+ umount /proc/fs/vmblock/mountPoint
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmblock && ok && return
+ fail
}
start_vmhgfs() {
is_no `module_exist vmhgfs` && return
# Check if the service is already running?
- if [ ! -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
- _modprobe single vmhgfs
- msg_starting "Open Virtual Machine vmhgfs script"
- busy
- mkdir -p /mnt/hgfs
- mount -t vmhgfs .host:/ /mnt/hgfs
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
- fail
- else
+ if [ -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
msg_already_running "Open Virtual Machine vmhgfs script"
+ return
fi
+
+ _modprobe single vmhgfs
+ msg_starting "Open Virtual Machine vmhgfs script"
+ busy
+ mkdir -p /mnt/hgfs
+ mount -t vmhgfs .host:/ /mnt/hgfs
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
+ fail
}
stop_vmhgfs() {
is_no `module_exist vmhgfs` && return
- if [ -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
- msg_stopping "Open Virtual Machine vmhgfs script"
- busy
- umount /mnt/hgfs
- RETVAL=$?
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
- fail
- else
+ if [ ! -f /var/lock/subsys/open-vm-tools-vmhgfs ]; then
msg_not_running "Open Virtual Machine vmhgfs script"
+ return
fi
+
+ msg_stopping "Open Virtual Machine vmhgfs script"
+ busy
+ umount /mnt/hgfs
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/open-vm-tools-vmhgfs && ok && return
+ fail
}
start_vmsync() {
# Check if the service is already running?
- if [ ! -f /var/lock/subsys/open-vm-tools-vmsync ]; then
- _modprobe single vmsync
- msg_starting "Open Virtual Machine vmsync script"
- daemon /usr/bin/vmtoolsd --background /var/run/vmtoolsd.pid
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmsync
- else
+ if [ -f /var/lock/subsys/open-vm-tools-vmsync ]; then
msg_already_running "Open Virtual Machine vmsync script"
+ return
fi
+
+ _modprobe single vmsync
+ msg_starting "Open Virtual Machine vmsync script"
+ daemon /usr/bin/vmtoolsd --background /var/run/vmtoolsd.pid
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/open-vm-tools-vmsync
}
stop_vmsync() {
- if [ -f /var/lock/subsys/open-vm-tools-vmsync ]; then
- msg_stopping "Open Virtual Machine vmsync script"
- killproc --pidfile vmtoolsd.pid vmtoolsd
- rm -f /var/lock/subsys/open-vm-tools-vmsync
- else
+ if [ ! -f /var/lock/subsys/open-vm-tools-vmsync ]; then
msg_not_running "Open Virtual Machine vmsync script"
+ return
fi
+
+ msg_stopping "Open Virtual Machine vmsync script"
+ killproc --pidfile vmtoolsd.pid vmtoolsd
+ rm -f /var/lock/subsys/open-vm-tools-vmsync
}
start() {
start
;;
stop)
- stop
+ stop
;;
restart)
- stop
- start
+ stop
+ start
;;
*)
msg_usage "$0 {start|stop|restart}"