updated on Tue Jan 10 12:02:00 UTC 2012
[aur-mirror.git] / libvirt-git / libvirtd.rc.d
blob193bffa9c0dda9044212153fa4ceec75dd91199e
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/conf.d/libvirtd
5 . /etc/rc.d/functions
7 LIBVIRTD_CONFIG_ARGS=
8 if [ -n "$LIBVIRTD_CONFIG" ]
9 then
10 LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
13 PID=`pidof -o %PPID /usr/sbin/libvirtd`
14 case "$1" in
15 start)
16 stat_busy "Starting libvirtd"
17 export RADVD=/usr/sbin/radvd
18 for i in /var/run/libvirt/qemu /var/run/libvirt/lxc /var/run/libvirt/uml /var/run/libvirt/network; do
19 [ -d $i ] || mkdir -p $i
20 done
21 [ -z "$PID" ] && (
22 mkdir -p /var/{cache,run}/libvirt
23 rm -rf /var/cache/libvirt/*
24 KRB5_KTNAME=$KRB5_KTNAME \
25 /usr/sbin/libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
27 if [ $? -gt 0 ]; then
28 stat_fail
29 else
30 add_daemon libvirtd
31 stat_done
34 stop)
35 stat_busy "Stopping libvirtd"
36 [ ! -z "$PID" ] && (
37 kill $PID &> /dev/null
38 rm -rf /var/cache/libvirt/*
39 rm -f /var/run/libvirtd.pid
41 if [ $? -gt 0 ]; then
42 stat_fail
43 else
44 rm_daemon libvirtd
45 stat_done
48 restart)
49 $0 stop
50 sleep 1
51 $0 start
53 reload)
54 stat_busy "Reloading libvirtd configuration"
55 [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null
56 if [ $? -gt 0 ]; then
57 stat_fail
58 else
59 stat_done
63 echo $"Usage: $0 {start|stop|restart|reload}"
65 esac
66 exit 0