2007-02-23 12:50:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-07-05 16:04:11 +00:00
|
|
|
# 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
|
2009-05-07 07:34:05 +00:00
|
|
|
# Required-Start: $network messagebus
|
|
|
|
# Should-Start: $named
|
2007-07-05 16:04:11 +00:00
|
|
|
# Should-Start: xend
|
2009-05-07 07:34:05 +00:00
|
|
|
# Should-Start: hal
|
2010-05-19 19:57:56 +00:00
|
|
|
# Should-Start: avahi-daemon
|
2009-05-07 07:34:05 +00:00
|
|
|
# Required-Stop: $network messagebus
|
|
|
|
# Should-Stop: $named
|
2007-07-05 16:04:11 +00:00
|
|
|
# Default-Start: 3 4 5
|
|
|
|
# Short-Description: daemon for libvirt virtualization API
|
2008-05-15 06:12:32 +00:00
|
|
|
# Description: This is a daemon for managing guest instances
|
2007-07-05 16:04:11 +00:00
|
|
|
# and libvirt virtual networks
|
|
|
|
# See http://libvirt.org
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
# the following is chkconfig init header
|
|
|
|
#
|
2008-05-15 06:12:32 +00:00
|
|
|
# libvirtd: guest and virtual network management daemon
|
2007-02-23 12:50:58 +00:00
|
|
|
#
|
|
|
|
# chkconfig: 345 97 03
|
2010-05-19 19:57:56 +00:00
|
|
|
# description: This is a daemon for managing guest instances \
|
|
|
|
# and libvirt virtual networks \
|
2007-02-23 12:50:58 +00:00
|
|
|
# See http://libvirt.org
|
|
|
|
#
|
2007-07-05 16:04:11 +00:00
|
|
|
# processname: libvirtd
|
|
|
|
# pidfile: @localstatedir@/run/libvirtd.pid
|
2007-02-23 12:50:58 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. @sysconfdir@/rc.d/init.d/functions
|
|
|
|
|
|
|
|
SERVICE=libvirtd
|
2007-06-26 23:04:49 +00:00
|
|
|
PROCESS=libvirtd
|
2009-11-12 19:31:48 +00:00
|
|
|
PIDFILE=@localstatedir@/run/$SERVICE.pid
|
2007-02-23 12:50:58 +00:00
|
|
|
|
2007-06-26 23:48:46 +00:00
|
|
|
LIBVIRTD_CONFIG=
|
|
|
|
LIBVIRTD_ARGS=
|
2007-12-05 15:24:15 +00:00
|
|
|
KRB5_KTNAME=/etc/libvirt/krb5.tab
|
2007-06-26 23:48:46 +00:00
|
|
|
|
|
|
|
test -f @sysconfdir@/sysconfig/libvirtd && . @sysconfdir@/sysconfig/libvirtd
|
|
|
|
|
|
|
|
LIBVIRTD_CONFIG_ARGS=
|
|
|
|
if [ -n "$LIBVIRTD_CONFIG" ]
|
|
|
|
then
|
|
|
|
LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
|
|
|
|
fi
|
2007-02-23 12:50:58 +00:00
|
|
|
|
|
|
|
RETVAL=0
|
|
|
|
|
|
|
|
start() {
|
|
|
|
echo -n $"Starting $SERVICE daemon: "
|
2008-06-10 10:43:28 +00:00
|
|
|
mkdir -p @localstatedir@/cache/libvirt
|
|
|
|
rm -rf @localstatedir@/cache/libvirt/*
|
2009-11-12 19:31:48 +00:00
|
|
|
KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
|
2007-02-23 12:50:58 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
echo -n $"Stopping $SERVICE daemon: "
|
|
|
|
|
2009-11-12 19:31:48 +00:00
|
|
|
killproc -p $PIDFILE $PROCESS
|
2007-02-23 12:50:58 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
if [ $RETVAL -eq 0 ]; then
|
|
|
|
rm -f @localstatedir@/lock/subsys/$SERVICE
|
2009-11-12 19:31:48 +00:00
|
|
|
rm -f $PIDFILE
|
2010-04-21 23:21:06 +00:00
|
|
|
rm -rf @localstatedir@/cache/libvirt/*
|
2007-02-23 12:50:58 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
reload() {
|
|
|
|
echo -n $"Reloading $SERVICE configuration: "
|
|
|
|
|
2009-11-12 19:31:48 +00:00
|
|
|
killproc -p $PIDFILE $PROCESS -HUP
|
2007-02-23 12:50:58 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
|
|
|
start|stop|restart|reload)
|
|
|
|
$1
|
|
|
|
;;
|
|
|
|
status)
|
2009-11-12 19:31:48 +00:00
|
|
|
status -p $PIDFILE $PROCESS
|
2007-02-23 12:50:58 +00:00
|
|
|
RETVAL=$?
|
|
|
|
;;
|
2007-07-05 16:04:11 +00:00
|
|
|
force-reload)
|
|
|
|
reload
|
2010-04-21 23:21:06 +00:00
|
|
|
;;
|
2007-07-05 16:04:11 +00:00
|
|
|
condrestart|try-restart)
|
2007-02-23 12:50:58 +00:00
|
|
|
[ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
|
|
|
|
;;
|
|
|
|
*)
|
2010-03-03 10:55:06 +00:00
|
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
|
2010-04-21 23:21:06 +00:00
|
|
|
exit 2
|
2007-02-23 12:50:58 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
exit $RETVAL
|