]> git.pld-linux.org Git - packages/libvirt.git/blame - libvirt.init
- unconditional noarch subpackages
[packages/libvirt.git] / libvirt.init
CommitLineData
e6545db1
SP
1#!/bin/sh
2# libvirtd: guest and virtual network management daemon
3#
4# chkconfig: 345 97 03
5# description: This is a daemon for managing guest instances
6# and libvirt virtual networks
7# See http://libvirt.org
8#
9# processname: libvirtd
10#
11
12LIBVIRTD_CONFIG=
13LIBVIRTD_ARGS=
14
15LIBVIRTD_CONFIG_ARGS=
17a653fb
ER
16if [ -n "$LIBVIRTD_CONFIG" ]; then
17 LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
e6545db1
SP
18fi
19
20# Source function library.
21. /etc/rc.d/init.d/functions
22
e6545db1
SP
23# Source config
24if [ -f /etc/sysconfig/libvirtd ] ; then
17a653fb 25 . /etc/sysconfig/libvirtd
e6545db1
SP
26fi
27
e6545db1 28start() {
b53bfab2 29 if [ -f /var/lock/subsys/libvirtd ]; then
3f6e33ef
ER
30 msg_already_running "libvirtd"
31 return
17a653fb 32 fi
3f6e33ef
ER
33
34 umask 077
276dac67 35 msg_starting "libvirtd"
2ca3dcc1 36 daemon /usr/sbin/libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
3f6e33ef
ER
37 RETVAL=$?
38 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/libvirtd
e6545db1
SP
39}
40
41stop() {
3f6e33ef
ER
42 if [ ! -f /var/lock/subsys/libvirtd ]; then
43 msg_not_running "libvirtd"
44 return
17a653fb 45 fi
3f6e33ef
ER
46
47 msg_stopping "libvirtd"
48 killproc libvirtd
49 rm -f /var/lock/subsys/libvirtd
e6545db1
SP
50}
51
d7e000b2
JR
52reload() {
53 if [ ! -f /var/lock/subsys/libvirtd ]; then
276dac67 54 msg_not_running "libvirtd"
d7e000b2
JR
55 RETVAL=7
56 return
57 fi
58
59 msg_reloading libvirtd
60 killproc libvirtd -HUP
61 RETVAL=$?
62}
63
e6545db1 64condrestart() {
3f6e33ef 65 if [ ! -f /var/lock/subsys/libvirtd ]; then
276dac67 66 msg_not_running "libvirtd"
17a653fb 67 RETVAL=$1
3f6e33ef 68 return
17a653fb 69 fi
3f6e33ef
ER
70
71 stop
72 start
e6545db1
SP
73}
74
75RETVAL=0
76case "$1" in
77 start)
17a653fb
ER
78 start
79 ;;
e6545db1 80 stop)
17a653fb
ER
81 stop
82 ;;
e6545db1 83 restart)
17a653fb
ER
84 stop
85 start
86 ;;
e6545db1 87 try-restart)
17a653fb
ER
88 condrestart 0
89 ;;
d7e000b2
JR
90 reload|force-reload)
91 reload
92 ;;
e6545db1 93 status)
17a653fb
ER
94 status libvirtd
95 ;;
e6545db1 96 *)
17a653fb
ER
97 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
98 exit 3
e6545db1
SP
99esac
100
101exit $RETVAL
This page took 0.074254 seconds and 4 git commands to generate.