]> git.pld-linux.org Git - packages/libvirt.git/blob - libvirt.init
- remote driver cannot be built as a module
[packages/libvirt.git] / libvirt.init
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
12 LIBVIRTD_CONFIG=
13 LIBVIRTD_ARGS=
14
15 LIBVIRTD_CONFIG_ARGS=
16 if [ -n "$LIBVIRTD_CONFIG" ]
17 then
18     LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
19 fi
20
21 # Source function library.
22 . /etc/rc.d/init.d/functions
23
24 sconf="/etc/libvirt/libvirtd.conf"
25
26 # Source config
27 if [ -f /etc/sysconfig/libvirtd ] ; then
28         . /etc/sysconfig/libvirtd
29 fi
30
31
32 start() {
33         if [ ! -f /var/lock/subsys/libvirtd ]; then
34                 umask 077
35                 msg_starting libvirtd
36                 daemon libvirtd libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
37                 RETVAL=$?
38                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/libvirtd
39         else
40                 msg_already_running libvirtd
41         fi
42 }
43
44 stop() {
45         if [ -f /var/lock/subsys/libvirtd ]; then
46                 msg_stopping libvirtd
47                 killproc libvirtd
48                 rm -f /var/lock/subsys/libvirtd
49         else
50                 msg_not_running libvirtd
51         fi
52 }
53
54 reload() {
55         if [ ! -f /var/lock/subsys/libvirtd ]; then
56                 msg_not_running libvirtd
57                 RETVAL=7
58                 return
59         fi
60
61         msg_reloading libvirtd
62         killproc libvirtd -HUP
63         RETVAL=$?
64 }
65
66 condrestart() {
67         if [ -f /var/lock/subsys/libvirtd ]; then
68                 stop
69                 start
70         else
71                 msg_not_running libvirtd
72                 RETVAL=$1
73         fi
74 }
75
76 RETVAL=0
77 case "$1" in
78   start)
79         start
80         ;;
81   stop)
82         stop
83         ;;
84   restart)
85         stop
86         start
87         ;;
88   try-restart)
89         condrestart 0
90         ;;
91   reload|force-reload)
92         reload
93         ;;
94   status)
95         status libvirtd
96         ;;
97   *)
98         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
99         exit 3
100 esac
101
102 exit $RETVAL
This page took 0.03401 seconds and 3 git commands to generate.