]> TLD Linux GIT Repositories - packages/libvirt.git/blob - virtlogd.init
- updated to 10.6.0
[packages/libvirt.git] / virtlogd.init
1 #!/bin/sh
2
3 # virtlogd:   virtual machine log manager
4 #
5 # chkconfig: 345 96 04
6 # description:  This is a daemon for managing logs
7 #               of virtual machine consoles
8 #
9 # processname: virtlogd
10 #
11
12 VIRTLOGD_ARGS=
13
14 # Source function library.
15 . /etc/rc.d/init.d/functions
16
17 # Source config
18 if [ -f /etc/sysconfig/virtlogd ] ; then
19         . /etc/sysconfig/virtlogd
20 fi
21
22 start() {
23         if [ -f /var/lock/subsys/virtlogd ]; then
24                 msg_already_running "virtlogd"
25                 return
26         fi
27
28         umask 077
29         msg_starting "virtlogd"
30         daemon /usr/sbin/virtlogd --daemon $VIRTLOGD_CONFIG_ARGS $VIRTLOGD_ARGS
31         RETVAL=$?
32         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/virtlogd
33 }
34
35 stop() {
36         if [ ! -f /var/lock/subsys/virtlogd ]; then
37                 msg_not_running "virtlogd"
38                 return
39         fi
40
41         msg_stopping "virtlogd"
42         killproc virtlogd
43         rm -f /var/lock/subsys/virtlogd
44 }
45
46
47 reload() {
48         if [ ! -f /var/lock/subsys/virtlogd ]; then
49                 msg_not_running "virtlogd"
50                 RETVAL=7
51                 return
52         fi
53
54         msg_reloading virtlogd
55         killproc virtlogd -HUP
56         RETVAL=$?
57 }
58
59 condrestart() {
60         if [ ! -f /var/lock/subsys/virtlogd ]; then
61                 msg_not_running "virtlogd"
62                 RETVAL=$1
63                 return
64         fi
65         stop
66         start
67 }
68
69 # See how we were called.
70 case "$1" in
71   start)
72         start
73         ;;
74   stop)
75         stop
76         ;;
77   restart)
78         stop
79         start
80         ;;
81   try-restart)
82         condrestart 0
83         ;;
84   reload|force-reload)
85         reload
86         ;;
87   status)
88         status virtlogd
89         ;;
90   *)
91         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
92         exit 3
93 esac
94 exit $RETVAL