You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.5 KiB
Bash
79 lines
1.5 KiB
Bash
#!/bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: connman
|
|
# Required-Start: $remote_fs $syslog dbus
|
|
# Required-Stop: $remote_fs $syslog dbus
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Connection Manager
|
|
### END INIT INFO
|
|
|
|
|
|
DAEMON=/usr/sbin/connmand
|
|
DESC="Connection Manager"
|
|
NAME=connmand
|
|
. /lib/lsb/init-functions
|
|
|
|
if [ -f /etc/default/connman ] ; then
|
|
. /etc/default/connman
|
|
fi
|
|
|
|
if [ "CONNMAN_RUNSTATEDIR_RESOLVCONF" != "no" ] ; then
|
|
mkdir -p /run/connman
|
|
ln -sf /run/connman/resolv.conf /etc/
|
|
fi
|
|
|
|
do_start() {
|
|
start-stop-daemon --start --oknodo --exec $DAEMON -- $DAEMON_OPTS
|
|
}
|
|
|
|
do_stop() {
|
|
start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
|
|
}
|
|
|
|
get_pid() {
|
|
[ -n "$1" ] || return 0
|
|
[ -S /run/dbus/system_bus_socket ] || return 0
|
|
|
|
dbus-send --system --dest=org.freedesktop.DBus --print-reply \
|
|
/org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \
|
|
string:$1 2>/dev/null | awk '/uint32/ {print $2}'
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
log_daemon_msg "Starting $DESC"
|
|
do_start
|
|
log_end_msg $?
|
|
;;
|
|
stop)
|
|
log_daemon_msg "Stopping $DESC"
|
|
do_stop
|
|
log_end_msg $?
|
|
;;
|
|
restart|force-reload)
|
|
log_daemon_msg "Restarting $DESC"
|
|
do_stop
|
|
sleep 1
|
|
do_start
|
|
log_end_msg $?
|
|
;;
|
|
status)
|
|
pid=$(get_pid net.connman)
|
|
if [ -n "$pid" ]; then
|
|
log_success_msg "$NAME is running"
|
|
return 0
|
|
else
|
|
log_failure_msg "$NAME is not running"
|
|
return 3 # LSB exit code for "program is not running"
|
|
fi
|
|
;;
|
|
*)
|
|
log_success_msg "Usage: $0 {start|stop|status|restart|force-reload}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|