# HG changeset patch # User Richard Dunbar # Date 1387837707 0 # Node ID dec89a82ee601020418a11407d7caf645a14b7a1 # Parent 7d6af743d21a83b84986e5d781b64d6d9cb7674f connman: use pidof string if no .pid file diff -r 7d6af743d21a -r dec89a82ee60 connman/stuff/etc/init.d/connman --- a/connman/stuff/etc/init.d/connman Mon Dec 23 16:58:02 2013 +0000 +++ b/connman/stuff/etc/init.d/connman Mon Dec 23 22:28:27 2013 +0000 @@ -1,8 +1,8 @@ #!/bin/sh -# /etc/init.d/connman : Start, stop and restart the connexion manager +# /etc/init.d/connman : Start, stop and restart the connection manager # on SliTaz, at boot time or with the command line. # -# To start the connexion manager at boot time, just put connman in the +# To start the connection manager at boot time, just put connman in the # $RUN_DAEMONS variable of /etc/rcS.conf and configure options with # /etc/daemons.conf # @@ -10,46 +10,53 @@ . /etc/daemons.conf NAME=Connman -DESC="Connexion Manager" -DAEMON=/usr/sbin/connmand +DESC="Connection Manager" +DAEMON=connmand OPTIONS=$CONNMAN_OPTIONS -PIDFILE=/run/connman +PIDFILE="$(pidof $DAEMON)" case "$1" in start) - if active_pidfile $PIDFILE connmand ; then - echo "$NAME already running." + if [ -n "$PIDFILE" ] ; then + echo "$NAME is already running." exit 1 fi - killall udhcpc 2>/dev/null + pkill udhcpc 2>/dev/null echo -n "Starting $DESC: $NAME... " $DAEMON $OPTIONS status ;; stop) - if ! active_pidfile $PIDFILE connmand ; then + if [ -z "$PIDFILE" ] ; then echo "$NAME is not running." exit 1 fi echo -n "Stopping $DESC: $NAME... " - rm -rf $PIDFILE - kill $(pidof connmand) + pkill $DAEMON + pkill wpa_supplicant status ;; restart) - if ! active_pidfile $PIDFILE connmand ; then + if [ -z "$PIDFILE" ] ; then echo "$NAME is not running." exit 1 fi echo -n "Restarting $DESC: $NAME... " - rm -rf $PIDFILE - kill $(pidof connmand) && + pkill $DAEMON && + pkill wpa_supplicant && sleep 2 && $DAEMON $OPTIONS status ;; + status) + if [ -n "$PIDFILE" ] ; then + echo "$NAME is running." + else + echo "$NAME is not running." + fi + ;; *) - printf "\n\033[1mUsage:\033[0m /etc/init.d/%b [start|stop|restart]\n" \ + printf "\n\033[1mUsage:\033[0m /etc/init.d/%b [start|stop|restart|status]\n" \ "$(basename $0)" exit 1 ;;