X-Git-Url: https://git.tld-linux.org/?p=packages%2Flibvirt.git;a=blobdiff_plain;f=libvirtd.init;fp=libvirtd.init;h=42c9d6412bd4ee117f8348d36f727443b64d159e;hp=0000000000000000000000000000000000000000;hb=392f6a6608e85bb2105c0ad3d5856c033cc35f6a;hpb=bbb630256f425fcee20b8f8067b21653bda4a86a diff --git a/libvirtd.init b/libvirtd.init new file mode 100755 index 0000000..42c9d64 --- /dev/null +++ b/libvirtd.init @@ -0,0 +1,101 @@ +#!/bin/sh +# 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 +# + +LIBVIRTD_CONFIG= +LIBVIRTD_ARGS= + +LIBVIRTD_CONFIG_ARGS= +if [ -n "$LIBVIRTD_CONFIG" ]; then + LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG" +fi + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source config +if [ -f /etc/sysconfig/libvirtd ] ; then + . /etc/sysconfig/libvirtd +fi + +start() { + if [ -f /var/lock/subsys/libvirtd ]; then + msg_already_running "libvirtd" + return + fi + + umask 077 + msg_starting "libvirtd" + daemon /usr/sbin/libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/libvirtd +} + +stop() { + if [ ! -f /var/lock/subsys/libvirtd ]; then + msg_not_running "libvirtd" + return + fi + + msg_stopping "libvirtd" + killproc libvirtd + rm -f /var/lock/subsys/libvirtd +} + +reload() { + if [ ! -f /var/lock/subsys/libvirtd ]; then + msg_not_running "libvirtd" + RETVAL=7 + return + fi + + msg_reloading libvirtd + killproc libvirtd -HUP + RETVAL=$? +} + +condrestart() { + if [ ! -f /var/lock/subsys/libvirtd ]; then + msg_not_running "libvirtd" + RETVAL=$1 + return + fi + + stop + start +} + +RETVAL=0 +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + reload|force-reload) + reload + ;; + status) + status libvirtd + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" + exit 3 +esac + +exit $RETVAL