aboutsummaryrefslogtreecommitdiff
path: root/system/open-vm-tools/rc.vmtoolsd
diff options
context:
space:
mode:
authorJEREMY HOCDE <jeremyhocde@gmail.com>2017-07-20 07:41:19 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-07-22 06:56:16 +0700
commit2f2c4818a9fa8c60376a332ef6d4118eaea1749d (patch)
treea9eeb0bdafa27131aa8de737329de39a92b8131b /system/open-vm-tools/rc.vmtoolsd
parent189a02b9119629cb5a938c8caddc2f2d7a0b332b (diff)
system/open-vm-tools: Added (VMware open-vm-tools project).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'system/open-vm-tools/rc.vmtoolsd')
-rw-r--r--system/open-vm-tools/rc.vmtoolsd58
1 files changed, 58 insertions, 0 deletions
diff --git a/system/open-vm-tools/rc.vmtoolsd b/system/open-vm-tools/rc.vmtoolsd
new file mode 100644
index 000000000000..bbecb2329d01
--- /dev/null
+++ b/system/open-vm-tools/rc.vmtoolsd
@@ -0,0 +1,58 @@
+#!/bin/sh
+# Start/stop/restart open-vm-tools.
+
+openvmtools_check() {
+ vmware-checkvm
+ if [ $? -ne 0 ]; then
+ echo "eRRoR with vmware-checkvm"
+ exit 1
+ fi
+}
+
+openvmtools_start() {
+ openvmtools_check
+ CMDLINE="/usr/bin/vmtoolsd --background=/var/run/vmtoolsd.pid"
+ echo -n "Starting vmtoolsd: $CMDLINE"
+ $CMDLINE || exit 2
+ echo
+}
+
+openvmtools_stop() {
+ VMPID=$(cat /var/run/vmtoolsd.pid)
+ echo -n "Stopping vmtoolsd (PID $VMPID)..."
+ kill -9 $VMPID
+ echo
+}
+
+openvmtools_restart() {
+ openvmtools_stop
+ sleep 1
+ openvmtools_start
+}
+
+# Check if openvmtools is running
+openvmtools_status() {
+ if [ -e /var/run/vmtoolsd.pid ]; then
+ echo "vmtoolsd is running."
+ else
+ echo "vmtoolsd is stopped."
+ exit 1
+ fi
+}
+
+case "$1" in
+'start')
+ openvmtools_start
+ ;;
+'stop')
+ openvmtools_stop
+ ;;
+'restart')
+ openvmtools_restart
+ ;;
+'status')
+ openvmtools_status
+ ;;
+*)
+ echo "usage $0 start|stop|restart|status"
+esac