]> git.pld-linux.org Git - packages/libvirt.git/blame - libvirt.init
- 0.9.11-rc1 with openvswitch support
[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=
16if [ -n "$LIBVIRTD_CONFIG" ]
17then
18 LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
19fi
20
21# Source function library.
22. /etc/rc.d/init.d/functions
23
24sconf="/etc/libvirt/libvirtd.conf"
25
26# Source config
27if [ -f /etc/sysconfig/libvirtd ] ; then
28 . /etc/sysconfig/libvirtd
29fi
30
31
32start() {
33 if [ ! -f /var/lock/subsys/libvirtd ]; then
34 umask 077
35 msg_starting libvirtd
3f3de736 36 daemon libvirtd libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
e6545db1
SP
37 RETVAL=$?
38 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/libvirtd
39 else
40 msg_already_running libvirtd
41 fi
42}
43
44stop() {
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
d7e000b2
JR
54reload() {
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
e6545db1
SP
66condrestart() {
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
76RETVAL=0
77case "$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 ;;
d7e000b2
JR
91 reload|force-reload)
92 reload
93 ;;
e6545db1
SP
94 status)
95 status libvirtd
96 ;;
97 *)
d7e000b2 98 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
e6545db1
SP
99 exit 3
100esac
101
102exit $RETVAL
This page took 0.448063 seconds and 4 git commands to generate.