]> git.pld-linux.org Git - packages/dbus.git/blob - messagebus.init
- updated to 1.2.24
[packages/dbus.git] / messagebus.init
1 #!/bin/sh
2 #
3 # messagebus    The D-BUS systemwide message bus
4 #
5 # chkconfig:    345 22 85
6 #
7 # description:  This is a daemon which broadcasts notifications of system
8 #               events and other messages.
9 #
10 # pidfile:      /var/run/dbus.pid
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get network config
16 . /etc/sysconfig/network
17
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20         if [ ! -f /var/lock/subsys/network ]; then
21                 msg_network_down "D-BUS Message bus"
22                 exit 1
23         fi
24 else
25         exit 0
26 fi
27
28 start() {
29         # Check if the service is already running?
30         if [ -f /var/lock/subsys/messagebus ]; then
31                 msg_already_running "D-BUS Message bus"
32                 return
33         fi
34
35         msg_starting "D-BUS Message bus"
36         # if capability is modular, load it
37         if modinfo capability >/dev/null 2>&1; then
38                 modprobe -s capability
39         fi
40         dbus-uuidgen --ensure
41         daemon --pidfile dbus.pid /usr/bin/dbus-daemon --system
42         RETVAL=$?
43         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/messagebus
44 }
45
46 stop() {
47         if [ ! -f /var/lock/subsys/messagebus ]; then
48                 msg_not_running "D-BUS Message bus"
49                 return
50         fi
51
52         # Stop daemons.
53         msg_stopping "D-BUS Message bus"
54         killproc --pidfile dbus.pid dbus-daemon
55         rm -f /var/lock/subsys/messagebus /var/run/dbus.pid
56 }
57
58 condrestart() {
59         if [ ! -f /var/lock/subsys/messagebus ]; then
60                 msg_not_running "D-BUS Message bus"
61                 RETVAL=$1
62                 return
63         fi
64
65         stop
66         start
67 }
68
69 reload() {
70         if [ ! -f /var/lock/subsys/messagebus ]; then
71                 msg_not_running "D-BUS Message bus"
72                 RETVAL=7
73                 return
74         fi
75
76         msg_reloading "D-BUS Message bus"
77         killproc --pidfile dbus.pid dbus-daemon -HUP
78         RETVAL=$?
79 }
80
81 RETVAL=0
82 # See how we were called.
83 case "$1" in
84   start)
85         start
86         ;;
87   stop)
88         stop
89         ;;
90   restart)
91         stop
92         start
93         ;;
94   try-restart)
95         condrestart 0
96         ;;
97   reload|force-reload)
98         reload
99         ;;
100   status)
101         status --pidfile dbus.pid messagebus dbus-daemon
102         RETVAL=$?
103         ;;
104   *)
105         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
106         exit 3
107 esac
108
109 exit $RETVAL
This page took 0.041307 seconds and 3 git commands to generate.