wok view dbus/stuff/etc/init.d/dbus @ rev 16589

dbus: fix init script (with /run and /var/run mounted as tmpfs, we can't preinstall /var/run/dbus, we must create it)
author Christophe Lincoln <pankso@slitaz.org>
date Mon May 05 19:10:34 2014 +0200 (2014-05-05)
parents 6f02ebda33d4
children 7f188676b59c
line source
1 #!/bin/sh
2 # /etc/init.d/dbus: Start, stop and restart DBUS daemon on SliTaz,
3 # at boot time or with the command line. Daemons options are configured
4 # with /etc/daemons.conf
5 #
6 . /etc/init.d/rc.functions
7 . /etc/daemons.conf
9 NAME=DBUS
10 DESC="message bus daemon"
11 DAEMON=/usr/bin/dbus-daemon
12 OPTIONS=$DBUS_OPTIONS
13 PIDFILE=/run/dbus/pid
14 MACHINE_ID=/var/lib/dbus/machine-id
16 if [ ! -f $MACHINE_ID ] ; then
17 dbus-uuidgen > $MACHINE_ID
18 fi
20 case "$1" in
21 start)
22 if active_pidfile $PIDFILE dbus-daemon ; then
23 echo "$NAME already running."
24 exit 1
25 fi
26 mkdir -p /run/dbus
27 echo -n "Starting $DESC: $NAME... "
28 $DAEMON $OPTIONS
29 status
30 ;;
31 stop)
32 if ! active_pidfile $PIDFILE dbus-daemon ; then
33 echo "$NAME is not running."
34 exit 1
35 fi
36 echo -n "Stopping $DESC: $NAME... "
37 kill `cat $PIDFILE`
38 rm $PIDFILE
39 status
40 ;;
41 restart)
42 if ! active_pidfile $PIDFILE dbus-daemon ; then
43 echo "$NAME is not running."
44 exit 1
45 fi
46 mkdir -p /run/dbus
47 echo -n "Restarting $DESC: $NAME... "
48 kill `cat $PIDFILE`
49 rm $PIDFILE
50 sleep 2
51 $DAEMON $OPTIONS
52 status
53 ;;
54 *)
55 echo ""
56 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
57 echo ""
58 exit 1
59 ;;
60 esac
62 exit 0