slackbuilds_ponce/system/open-vm-tools/rc.vmtoolsd
JEREMY HOCDE 2f2c4818a9 system/open-vm-tools: Added (VMware open-vm-tools project).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
2017-07-22 06:56:16 +07:00

58 lines
943 B
Bash

#!/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