65 lines
1.4 KiB
Bash
Executable File
65 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# the following is the LSB init header see
|
|
# http://www.linux-foundation.org/spec//booksets/LSB-Core-generic/LSB-Core-generic.html#INITSCRCOMCONV
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: vhostmd
|
|
# Required-Start:
|
|
# Should-Start: xend
|
|
# Default-Start: 3 5
|
|
# Required-Stop:
|
|
# Should-Stop: xend
|
|
# Default-Stop: 0 1 2 4 6
|
|
# Short-Description: daemon for virtualization metrics
|
|
# Description: This is a daemon for gathering VM metrics
|
|
### END INIT INFO
|
|
|
|
|
|
VHOSTMD_BIN=/usr/sbin/vhostmd
|
|
test -x $VHOSTMD_BIN || { echo "$VHOSTMDBIN not installed";
|
|
if [ "$1" = "stop" ]; then exit 0;
|
|
else exit 5; fi; }
|
|
|
|
|
|
. /etc/rc.status
|
|
rc_reset
|
|
|
|
|
|
case "$1" in
|
|
start)
|
|
echo -n "Starting vhostmd "
|
|
startproc $VHOSTMD_BIN
|
|
rc_status -v
|
|
;;
|
|
stop)
|
|
echo -n "Shutting down vhostmd "
|
|
killproc -TERM $VHOSTMD_BIN > /dev/null 2>&1
|
|
rc_status -v
|
|
;;
|
|
try-restart)
|
|
$0 status >/dev/null && $0 restart
|
|
rc_status
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
rc_status
|
|
;;
|
|
reload)
|
|
killproc -HUP $VHOSTMD_BIN
|
|
rc_status -v
|
|
;;
|
|
status)
|
|
echo -n "Checking status of vhostmd "
|
|
checkproc $VHOSTMD_BIN
|
|
rc_status -v
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|try-restart|reload|status}"
|
|
rc_failed 2
|
|
rc_exit
|
|
;;
|
|
esac
|
|
rc_exit
|