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