diff options
author | root <root@rshg054.dnsready.net> | 2012-05-18 00:02:20 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-05-18 00:02:20 +0000 |
commit | 2f104ecf78d6a93ba8d67273b76364cb1365a6cf (patch) | |
tree | c93787a9c08d8cb41a424644dc09fc529dfd63f1 /community-testing/libvirt/libvirtd.rc.d | |
parent | f675762300c4ee2717e029975bb3f94312245276 (diff) |
Fri May 18 00:02:20 UTC 2012
Diffstat (limited to 'community-testing/libvirt/libvirtd.rc.d')
-rw-r--r-- | community-testing/libvirt/libvirtd.rc.d | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/community-testing/libvirt/libvirtd.rc.d b/community-testing/libvirt/libvirtd.rc.d new file mode 100644 index 000000000..193bffa9c --- /dev/null +++ b/community-testing/libvirt/libvirtd.rc.d @@ -0,0 +1,66 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/conf.d/libvirtd +. /etc/rc.d/functions + +LIBVIRTD_CONFIG_ARGS= +if [ -n "$LIBVIRTD_CONFIG" ] +then + LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG" +fi + +PID=`pidof -o %PPID /usr/sbin/libvirtd` +case "$1" in + start) + stat_busy "Starting libvirtd" + export RADVD=/usr/sbin/radvd + for i in /var/run/libvirt/qemu /var/run/libvirt/lxc /var/run/libvirt/uml /var/run/libvirt/network; do + [ -d $i ] || mkdir -p $i + done + [ -z "$PID" ] && ( + mkdir -p /var/{cache,run}/libvirt + rm -rf /var/cache/libvirt/* + KRB5_KTNAME=$KRB5_KTNAME \ + /usr/sbin/libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS + ) + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon libvirtd + stat_done + fi + ;; + stop) + stat_busy "Stopping libvirtd" + [ ! -z "$PID" ] && ( + kill $PID &> /dev/null + rm -rf /var/cache/libvirt/* + rm -f /var/run/libvirtd.pid + ) + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon libvirtd + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + reload) + stat_busy "Reloading libvirtd configuration" + [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload}" + ;; +esac +exit 0 |