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

Add tlp
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Mar 13 23:01:20 2018 +0100 (2018-03-13)
parents d4cf16d55526
children
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 _ '%s is already running.' $NAME
24 exit 1
25 fi
26 mkdir -p /run/dbus
27 action 'Starting %s: %s...' "$DESC" $NAME
28 $DAEMON $OPTIONS
29 status
30 ;;
31 stop)
32 if ! active_pidfile $PIDFILE dbus-daemon ; then
33 _ '%s is not running.' $NAME
34 exit 1
35 fi
36 action 'Stopping %s: %s...' "$DESC" $NAME
37 kill $(cat $PIDFILE)
38 rm $PIDFILE
39 status
40 ;;
41 restart)
42 if ! active_pidfile $PIDFILE dbus-daemon ; then
43 _ '%s is not running.' $NAME
44 exit 1
45 fi
46 mkdir -p /run/dbus
47 action 'Restarting %s: %s...' "$DESC" $NAME
48 kill $(cat $PIDFILE)
49 rm $PIDFILE
50 sleep 2
51 $DAEMON $OPTIONS
52 status
53 ;;
54 *)
55 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
56 newline
57 exit 1
58 ;;
59 esac
61 exit 0