wok annotate connman/stuff/etc/init.d/connman @ rev 19361
Up tazpkg (919)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 03 08:46:48 2016 +0200 (2016-08-03) |
parents | dec89a82ee60 |
children | 1160f587fa15 |
rev | line source |
---|---|
domcox@14329 | 1 #!/bin/sh |
mojo@15712 | 2 # /etc/init.d/connman : Start, stop and restart the connection manager |
domcox@14329 | 3 # on SliTaz, at boot time or with the command line. |
domcox@14329 | 4 # |
mojo@15712 | 5 # To start the connection manager at boot time, just put connman in the |
domcox@14329 | 6 # $RUN_DAEMONS variable of /etc/rcS.conf and configure options with |
domcox@14329 | 7 # /etc/daemons.conf |
domcox@14329 | 8 # |
domcox@14329 | 9 . /etc/init.d/rc.functions |
domcox@14329 | 10 . /etc/daemons.conf |
domcox@14329 | 11 |
domcox@14329 | 12 NAME=Connman |
al@19159 | 13 DESC="$(_ 'Connection Manager')" |
mojo@15712 | 14 DAEMON=connmand |
domcox@14329 | 15 OPTIONS=$CONNMAN_OPTIONS |
mojo@15712 | 16 PIDFILE="$(pidof $DAEMON)" |
domcox@14329 | 17 |
domcox@14329 | 18 case "$1" in |
domcox@14329 | 19 start) |
mojo@15712 | 20 if [ -n "$PIDFILE" ] ; then |
al@19159 | 21 _ '%s is already running.' $NAME |
domcox@14329 | 22 exit 1 |
domcox@14329 | 23 fi |
mojo@15712 | 24 pkill udhcpc 2>/dev/null |
al@19159 | 25 action 'Starting %s: %s...' "$DESC" $NAME |
domcox@14329 | 26 $DAEMON $OPTIONS |
domcox@14329 | 27 status |
domcox@14329 | 28 ;; |
domcox@14329 | 29 stop) |
mojo@15712 | 30 if [ -z "$PIDFILE" ] ; then |
al@19159 | 31 _ '%s is not running.' $NAME |
domcox@14329 | 32 exit 1 |
domcox@14329 | 33 fi |
al@19159 | 34 action 'Stopping %s: %s...' "$DESC" $NAME |
mojo@15712 | 35 pkill $DAEMON |
mojo@15712 | 36 pkill wpa_supplicant |
pascal@15577 | 37 status |
domcox@14329 | 38 ;; |
domcox@14329 | 39 restart) |
mojo@15712 | 40 if [ -z "$PIDFILE" ] ; then |
al@19159 | 41 _ '%s is not running.' $NAME |
domcox@14329 | 42 exit 1 |
domcox@14329 | 43 fi |
al@19159 | 44 action 'Restarting %s: %s...' "$DESC" $NAME |
mojo@15712 | 45 pkill $DAEMON && |
mojo@15712 | 46 pkill wpa_supplicant && |
domcox@14329 | 47 sleep 2 && |
domcox@14329 | 48 $DAEMON $OPTIONS |
domcox@14329 | 49 status |
domcox@14329 | 50 ;; |
mojo@15712 | 51 status) |
mojo@15712 | 52 if [ -n "$PIDFILE" ] ; then |
al@19159 | 53 _ '%s is running.' $NAME |
mojo@15712 | 54 else |
al@19159 | 55 _ '%s is not running.' $NAME |
al@19159 | 56 fi |
mojo@15712 | 57 ;; |
domcox@14329 | 58 *) |
al@19159 | 59 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|status]" |
al@19159 | 60 newline |
domcox@14329 | 61 ;; |
domcox@14329 | 62 esac |
domcox@14329 | 63 |
domcox@14329 | 64 exit 0 |