mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-08 22:39:56 +00:00
6dc0e4f171
Commit b22344f328
mistakenly reordered
Default-* lines. Thanks to that I noticed that we are very inconsistent
with our init scripts, so I took the liberty of synchronizing them,
updating them and making them all look shiny and new. So apart from
fixing the LSB requirements, I also fixed the ordering, specified
runlevels and fix the link to the reference specification.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
123 lines
2.8 KiB
Bash
123 lines
2.8 KiB
Bash
#!/bin/sh
|
|
|
|
# the following is the LSB init header see
|
|
# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: libvirtd
|
|
# Default-Start: 3 4 5
|
|
# Default-Stop: 0 1 2 6
|
|
# Required-Start: $network messagebus virtlogd
|
|
# Required-Stop: $network messagebus
|
|
# Should-Start: $named xend avahi-daemon virtlockd
|
|
# Should-Stop: $named
|
|
# 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
|
|
#
|
|
|
|
# Source function library.
|
|
. @sysconfdir@/rc.d/init.d/functions
|
|
|
|
SERVICE=libvirtd
|
|
PROCESS=libvirtd
|
|
PIDFILE=@localstatedir@/run/$SERVICE.pid
|
|
|
|
LIBVIRTD_CONFIG=
|
|
LIBVIRTD_ARGS=
|
|
KRB5_KTNAME=/etc/libvirt/krb5.tab
|
|
|
|
test -f @sysconfdir@/sysconfig/libvirtd && . @sysconfdir@/sysconfig/libvirtd
|
|
|
|
export QEMU_AUDIO_DRV
|
|
export SDL_AUDIODRIVER
|
|
|
|
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/*
|
|
|
|
# LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
|
|
# automatically
|
|
if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
|
|
ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
|
|
fi
|
|
|
|
KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --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 -p $PIDFILE $PROCESS
|
|
RETVAL=$?
|
|
echo
|
|
if [ $RETVAL -eq 0 ]; then
|
|
rm -f @localstatedir@/lock/subsys/$SERVICE
|
|
rm -rf @localstatedir@/cache/libvirt/*
|
|
else
|
|
exit $RETVAL
|
|
fi
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
reload() {
|
|
echo -n $"Reloading $SERVICE configuration: "
|
|
|
|
killproc -p $PIDFILE $PROCESS -HUP
|
|
RETVAL=$?
|
|
echo
|
|
return $RETVAL
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start|stop|restart|reload)
|
|
$1
|
|
;;
|
|
status)
|
|
status -p $PIDFILE $PROCESS
|
|
RETVAL=$?
|
|
;;
|
|
force-reload)
|
|
reload
|
|
;;
|
|
condrestart|try-restart)
|
|
[ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
|
|
exit 2
|
|
;;
|
|
esac
|
|
exit $RETVAL
|