File: libvirtd.init.in

package info (click to toggle)
libvirt 0.4.6-10%2Blenny2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 29,084 kB
  • ctags: 8,508
  • sloc: ansic: 75,483; xml: 11,901; sh: 10,518; python: 4,309; makefile: 863; perl: 356; awk: 48; sed: 16
file content (109 lines) | stat: -rw-r--r-- 2,435 bytes parent folder | download
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
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh

# the following is the LSB init header see
# http://www.linux-foundation.org/spec//booksets/LSB-Core-generic/LSB-Core-generic.html#INITSCRCOMCONV
#
### BEGIN INIT INFO
# Provides: libvirtd
# Should-Start: xend
# Default-Start: 3 4 5
# Short-Description: daemon for libvirt virtualization API
# Description: This is a daemon for managing guest instances
#              and libvirt virtual networks
#              See http://libvirt.org
### END INIT INFO

# the following is chkconfig init header
#
# libvirtd:   guest and virtual network management daemon
#
# chkconfig: 345 97 03
# description:  This is a daemon for managing guest instances
#               and libvirt virtual networks
#               See http://libvirt.org
#
# processname: libvirtd
# pidfile: @localstatedir@/run/libvirtd.pid
#

# Sanity checks.
[ -x @sbindir@/libvirtd ] || exit 0

# Source function library.
. @sysconfdir@/rc.d/init.d/functions

SERVICE=libvirtd
PROCESS=libvirtd

LIBVIRTD_CONFIG=
LIBVIRTD_ARGS=
KRB5_KTNAME=/etc/libvirt/krb5.tab

test -f @sysconfdir@/sysconfig/libvirtd && . @sysconfdir@/sysconfig/libvirtd

LIBVIRTD_CONFIG_ARGS=
if [ -n "$LIBVIRTD_CONFIG" ]
then
    LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
fi

RETVAL=0

start() {
    echo -n $"Starting $SERVICE daemon: "
    mkdir -p @localstatedir@/cache/libvirt
    rm -rf @localstatedir@/cache/libvirt/*
    KRB5_KTNAME=$KRB5_KTNAME daemon --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
}

stop() {
    echo -n $"Stopping $SERVICE daemon: "

    killproc $PROCESS
    RETVAL=$?
    echo
    if [ $RETVAL -eq 0 ]; then
        rm -f @localstatedir@/lock/subsys/$SERVICE
        rm -f @localstatedir@/run/$SERVICE.pid
	rm -rf @localstatedir@/cache/libvirt/*
    fi
}

restart() {
    stop
    start
}

reload() {
    echo -n $"Reloading $SERVICE configuration: "

    killproc $PROCESS -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

# See how we were called.
case "$1" in
    start|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