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