forked from zaneb/libvirt-qmf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibvirt-qmf.init.in
executable file
·96 lines (83 loc) · 2.08 KB
/
libvirt-qmf.init.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# the following is chkconfig init header
# libvirt-qmf: QMF agent for libvirt
### BEGIN INIT INFO
# Provides: libvirt-qmf
# Should-Start: libvirtd
# Required-Start: $local_fs matahari-broker
# Required-Stop: $local_fs matahari-broker
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts and stops the libvirt-qmf matahari agent
# Description: Matahari agent providing an API to libvirt using the AMQP protocol.
### END INIT INFO
# chkconfig: - 99 01
# Description: Matahari agent providing an API to libvirt using the AMQP protocol.
# processname: libvirt-qmf
# pidfile: @localstatedir@/run/libvirt-qmf.pid
#
# Source function library.
. @sysconfdir@/rc.d/init.d/functions
SERVICE=libvirt-qmf
PROCESS=libvirt-qmf
RETVAL=0
test -f @sysconfdir@/sysconfig/matahari && . @sysconfdir@/sysconfig/matahari
start() {
echo -n $"Starting the $SERVICE daemon: "
ARGS=--daemon
if [ -n "$MATAHARI_PORT" ]; then
ARGS="--port $MATAHARI_PORT $ARGS"
fi
if [ -n "$MATAHARI_BROKER" ]; then
ARGS="--broker $MATAHARI_BROKER $ARGS"
fi
daemon $PROCESS $ARGS $MATAHARI_AGENT_ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
}
stop() {
echo -n $"Stopping the $SERVICE daemon: "
killproc $PROCESS
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
rm -f @localstatedir@/lock/subsys/$SERVICE
rm -f @localstatedir@/run/$SERVICE.pid
fi
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading the $SERVICE configuration: "
killproc $PROCESS -HUP
RETVAL=$?
echo
return $RETVAL
}
# See how we were called.
case "$1" in
start)
status $PROCESS >/dev/null || $1
;;
stop|restart|reload)
$1
;;
status)
status $PROCESS
RETVAL=$?
;;
force-reload)
reload
;;
condrestart|try-restart)
[ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
exit 1
;;
esac
exit $RETVAL