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
|
2016-01-07 08:50:26 +00:00
|
|
|
# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
|
2007-07-05 16:04:11 +00:00
|
|
|
#
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: libvirtd
|
2016-01-07 08:50:26 +00:00
|
|
|
# Default-Start: 3 4 5
|
|
|
|
# Default-Stop: 0 1 2 6
|
2015-12-04 13:52:55 +00:00
|
|
|
# Required-Start: $network messagebus virtlogd
|
2009-05-07 07:34:05 +00:00
|
|
|
# Required-Stop: $network messagebus
|
2016-01-07 08:50:26 +00:00
|
|
|
# Should-Start: $named xend avahi-daemon virtlockd
|
2009-05-07 07:34:05 +00:00
|
|
|
# Should-Stop: $named
|
2007-07-05 16:04:11 +00:00
|
|
|
# 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
|
|
|
|
|
2010-05-19 20:03:52 +00:00
|
|
|
export QEMU_AUDIO_DRV
|
|
|
|
export SDL_AUDIODRIVER
|
|
|
|
|
2007-06-26 23:48:46 +00:00
|
|
|
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/*
|
2012-01-12 17:47:30 +00:00
|
|
|
|
|
|
|
# LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
|
|
|
|
# automatically
|
|
|
|
if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
|
|
|
|
ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
|
|
|
|
fi
|
|
|
|
|
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
|
2010-04-21 23:21:06 +00:00
|
|
|
rm -rf @localstatedir@/cache/libvirt/*
|
2011-08-15 07:44:39 +00:00
|
|
|
else
|
|
|
|
exit $RETVAL
|
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
|