wok annotate connman/stuff/etc/init.d/connman @ rev 15501

connman: kill dhcpd before starting
author Dominique Corbex <domcox@slitaz.org>
date Sun Nov 17 16:55:13 2013 +0100 (2013-11-17)
parents 0199371990b2
children 8ebec64e4191
rev   line source
domcox@14329 1 #!/bin/sh
domcox@14329 2 # /etc/init.d/connman : Start, stop and restart the connexion manager
domcox@14329 3 # on SliTaz, at boot time or with the command line.
domcox@14329 4 #
domcox@14329 5 # To start the connexion 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
domcox@14329 13 DESC="Connexion Manager"
domcox@14329 14 DAEMON=/usr/sbin/connmand
domcox@14329 15 OPTIONS=$CONNMAN_OPTIONS
domcox@14329 16 PIDFILE=/run/connman
domcox@14329 17
domcox@14329 18 case "$1" in
domcox@14329 19 start)
domcox@14329 20 if [ -d $PIDFILE ] ; then
domcox@14329 21 echo "$NAME already running."
domcox@14329 22 exit 1
domcox@14329 23 fi
domcox@15501 24 killall udhcpc 2>/dev/null
domcox@14329 25 echo -n "Starting $DESC: $NAME... "
domcox@14329 26 $DAEMON $OPTIONS
domcox@14329 27 status
domcox@14329 28 ;;
domcox@14329 29 stop)
domcox@14329 30 if [ -z "$(pidof connmand)" ] ; then
domcox@14329 31 echo "$NAME is not running."
domcox@14383 32 rm -rf $PIDFILE
domcox@14329 33 exit 1
domcox@14329 34 fi
domcox@14329 35 echo -n "Stopping $DESC: $NAME... "
domcox@14329 36 rm -rf $PIDFILE
domcox@14329 37 kill $(pidof connmand)
domcox@14329 38 status
domcox@14329 39 ;;
domcox@14329 40 restart)
domcox@14329 41 if [ -z "$(pidof connmand)" ]; then
domcox@14329 42 echo "$NAME is not running."
domcox@14329 43 exit 1
domcox@14329 44 fi
domcox@14329 45 echo -n "Restarting $DESC: $NAME... "
domcox@14329 46 rm -rf $PIDFILE
domcox@14329 47 kill $(pidof connmand) &&
domcox@14329 48 sleep 2 &&
domcox@14329 49 $DAEMON $OPTIONS
domcox@14329 50 status
domcox@14329 51 ;;
domcox@14329 52 *)
domcox@14383 53 printf "\n\033[1mUsage:\033[0m /etc/init.d/%b [start|stop|restart]\n" \
domcox@14383 54 "$(basename $0)"
domcox@14329 55 exit 1
domcox@14329 56 ;;
domcox@14329 57 esac
domcox@14329 58
domcox@14329 59 exit 0