Upload etc/init.d/dbus with huggingface_hub
Browse files- etc/init.d/dbus +129 -0
etc/init.d/dbus
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
### BEGIN INIT INFO
|
3 |
+
# Provides: dbus
|
4 |
+
# Required-Start: $remote_fs $syslog
|
5 |
+
# Required-Stop: $remote_fs $syslog
|
6 |
+
# Default-Start: 2 3 4 5
|
7 |
+
# Default-Stop:
|
8 |
+
# Short-Description: D-Bus systemwide message bus
|
9 |
+
# Description: D-Bus is a simple interprocess messaging system, used
|
10 |
+
# for sending messages between applications.
|
11 |
+
### END INIT INFO
|
12 |
+
# -*- coding: utf-8 -*-
|
13 |
+
# Debian init.d script for D-BUS
|
14 |
+
# Copyright © 2003 Colin Walters <walters@debian.org>
|
15 |
+
# Copyright © 2005 Sjoerd Simons <sjoerd@debian.org>
|
16 |
+
|
17 |
+
set -e
|
18 |
+
|
19 |
+
DAEMON=/usr/bin/dbus-daemon
|
20 |
+
UUIDGEN=/usr/bin/dbus-uuidgen
|
21 |
+
UUIDGEN_OPTS=--ensure
|
22 |
+
NAME=dbus
|
23 |
+
DAEMONUSER=messagebus
|
24 |
+
PIDDIR=/var/run/dbus
|
25 |
+
PIDFILE=$PIDDIR/pid
|
26 |
+
DESC="system message bus"
|
27 |
+
|
28 |
+
test -x $DAEMON || exit 0
|
29 |
+
|
30 |
+
. /lib/lsb/init-functions
|
31 |
+
|
32 |
+
# Source defaults file; edit that file to configure this script.
|
33 |
+
PARAMS=""
|
34 |
+
if [ -e /etc/default/dbus ]; then
|
35 |
+
. /etc/default/dbus
|
36 |
+
fi
|
37 |
+
|
38 |
+
create_machineid() {
|
39 |
+
# Create machine-id file
|
40 |
+
if [ -x $UUIDGEN ]; then
|
41 |
+
$UUIDGEN $UUIDGEN_OPTS
|
42 |
+
fi
|
43 |
+
}
|
44 |
+
|
45 |
+
start_it_up()
|
46 |
+
{
|
47 |
+
if [ ! -d $PIDDIR ]; then
|
48 |
+
mkdir -p $PIDDIR
|
49 |
+
chown $DAEMONUSER $PIDDIR
|
50 |
+
chgrp $DAEMONUSER $PIDDIR
|
51 |
+
fi
|
52 |
+
|
53 |
+
if ! mountpoint -q /proc/ ; then
|
54 |
+
log_failure_msg "Can't start $DESC - /proc is not mounted"
|
55 |
+
return
|
56 |
+
fi
|
57 |
+
|
58 |
+
if [ -e $PIDFILE ]; then
|
59 |
+
if $0 status > /dev/null ; then
|
60 |
+
log_success_msg "$DESC already started; not starting."
|
61 |
+
return
|
62 |
+
else
|
63 |
+
log_success_msg "Removing stale PID file $PIDFILE."
|
64 |
+
rm -f $PIDFILE
|
65 |
+
fi
|
66 |
+
fi
|
67 |
+
|
68 |
+
create_machineid
|
69 |
+
|
70 |
+
# Force libnss-systemd to avoid trying to communicate via D-Bus, which
|
71 |
+
# is never going to work well from within dbus-daemon. systemd
|
72 |
+
# special-cases this internally, but we might need to do the same when
|
73 |
+
# booting with sysvinit if libnss-systemd is still installed.
|
74 |
+
# (Workaround for #940971)
|
75 |
+
export SYSTEMD_NSS_BYPASS_BUS=1
|
76 |
+
|
77 |
+
log_daemon_msg "Starting $DESC" "$NAME"
|
78 |
+
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
79 |
+
--exec $DAEMON -- --system $PARAMS
|
80 |
+
log_end_msg $?
|
81 |
+
}
|
82 |
+
|
83 |
+
shut_it_down()
|
84 |
+
{
|
85 |
+
log_daemon_msg "Stopping $DESC" "$NAME"
|
86 |
+
start-stop-daemon --stop --retry 5 --quiet --oknodo --pidfile $PIDFILE \
|
87 |
+
--user $DAEMONUSER
|
88 |
+
# We no longer include these arguments so that start-stop-daemon
|
89 |
+
# can do its job even given that we may have been upgraded.
|
90 |
+
# We rely on the pidfile being sanely managed
|
91 |
+
# --exec $DAEMON -- --system $PARAMS
|
92 |
+
log_end_msg $?
|
93 |
+
rm -f $PIDFILE
|
94 |
+
}
|
95 |
+
|
96 |
+
reload_it()
|
97 |
+
{
|
98 |
+
create_machineid
|
99 |
+
log_action_begin_msg "Reloading $DESC config"
|
100 |
+
dbus-send --print-reply --system --type=method_call \
|
101 |
+
--dest=org.freedesktop.DBus \
|
102 |
+
/ org.freedesktop.DBus.ReloadConfig > /dev/null
|
103 |
+
# hopefully this is enough time for dbus to reload it's config file.
|
104 |
+
log_action_end_msg $?
|
105 |
+
}
|
106 |
+
|
107 |
+
case "$1" in
|
108 |
+
start)
|
109 |
+
start_it_up
|
110 |
+
;;
|
111 |
+
stop)
|
112 |
+
shut_it_down
|
113 |
+
;;
|
114 |
+
reload|force-reload)
|
115 |
+
reload_it
|
116 |
+
;;
|
117 |
+
restart)
|
118 |
+
shut_it_down
|
119 |
+
start_it_up
|
120 |
+
;;
|
121 |
+
status)
|
122 |
+
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
123 |
+
;;
|
124 |
+
*)
|
125 |
+
echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|status}" >&2
|
126 |
+
exit 2
|
127 |
+
;;
|
128 |
+
esac
|
129 |
+
|