]> git.pld-linux.org Git - packages/libvirt.git/blob - libvirt.init
- pl
[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 condrestart() {
55         if [ -f /var/lock/subsys/libvirtd ]; then
56                 stop
57                 start
58         else
59                 msg_not_running libvirtd
60                 RETVAL=$1
61         fi
62 }
63
64 RETVAL=0
65 case "$1" in
66   start)
67         start
68         ;;
69   stop)
70         stop
71         ;;
72   restart)
73         stop
74         start
75         ;;
76   try-restart)
77         condrestart 0
78         ;;
79   status)
80         status libvirtd
81         ;;
82   *)
83         msg_usage "$0 {start|stop|restart|try-restart|status}"
84         exit 3
85 esac
86
87 exit $RETVAL
This page took 0.03093 seconds and 3 git commands to generate.