]> git.pld-linux.org Git - packages/dbus.git/blob - messagebus.init
d4a1162c5286822a7f82a5f8ab9ddce3bc37bd21
[packages/dbus.git] / messagebus.init
1 #!/bin/sh
2 #
3 # messagebus    The D-BUS systemwide message bus
4 #
5 # chkconfig:    345 97 03
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                 # nls "ERROR: Networking is down. %s can't be run." messagebus
22                 msg_network_down messagebus
23                 exit 1
24         fi
25 else
26         exit 0
27 fi
28
29
30 # See how we were called.
31 case "$1" in
32   start)
33         # Check if the service is already running?
34         if [ ! -f /var/lock/subsys/messagebus ]; then
35                 # show "Starting %s service" messagebus
36                 msg_starting messagebus
37                 daemon dbus-daemon --system
38                 RETVAL=$?
39                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/messagebus
40         else
41                 # show "%s service is already running." messagebus
42                 msg_already_running messagebus
43         fi
44         ;;
45   stop)
46         if [ -f /var/lock/subsys/messagebus ]; then
47                 # Stop daemons.
48                 # show "Stopping %s service" messagebus
49                 msg_stopping messagebus
50                 killproc --pidfile dbus.pid
51                 rm -f /var/lock/subsys/messagebus
52                 rm -f /var/run/dbus.pid
53         else
54                 # show "%s service is not running." messagebus
55                 msg_not_running messagebus
56         fi
57         ;;
58   restart)
59         $0 stop
60         $0 start
61         exit $?
62         ;;
63   reload)
64         if [ -f /var/lock/subsys/messagebus ]; then
65                 # show "Reload %s service" messagebus
66                 msg_reloading messagebus
67                 killproc dbus-daemon -HUP
68                 RETVAL=$?
69         else
70                 # show "%s service is not running." messagebus
71                 msg_not_running messagebus >&2
72                 RETVAL=7
73         fi
74         ;;
75   force-reload)
76         # if program allows reloading without stopping
77         $0 reload
78
79         # or if it doesn't
80         $0 restart
81
82         exit $?
83         ;;
84   status)
85         status messagebus
86         RETVAL=$?
87         ;;
88   *)
89         # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
90         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
91         exit 3
92 esac
93
94 exit $RETVAL
95
96 # This must be last line !
97 # vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.028318 seconds and 3 git commands to generate.