dropbear: use pidfile for daemon start/stop/restart
authorRoman I Khimov <khimov@altell.ru>
Mon, 19 Jul 2010 13:08:08 +0000 (17:08 +0400)
committerRoman I Khimov <khimov@altell.ru>
Thu, 29 Jul 2010 07:06:38 +0000 (11:06 +0400)
Old init script killed all dropbear processes when doing stop/restart
including open SSH sessions which is very annoying.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
recipes/dropbear/dropbear.inc
recipes/dropbear/dropbear/init

index af00129..1569ea3 100644 (file)
@@ -6,7 +6,7 @@ DEPENDS = "zlib"
 PROVIDES = "ssh sshd"
 RPROVIDES_${PN} = "ssh sshd"
 
-INC_PR = "r4"
+INC_PR = "r5"
 
 SRC_URI = "\
   http://matt.ucc.asn.au/dropbear/dropbear-${PV}.tar.bz2 \
index 275aa32..9bf7fbb 100755 (executable)
@@ -7,6 +7,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/dropbear
 NAME=dropbear
 DESC="Dropbear SSH server"
+PIDFILE=/var/run/dropbear.pid
 
 DROPBEAR_PORT=22
 DROPBEAR_EXTRA_ARGS=
@@ -75,24 +76,24 @@ case "$1" in
        KEY_ARGS=""
        test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
        test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
-       start-stop-daemon -S \
+       start-stop-daemon -S -p $PIDFILE \
          -x "$DAEMON" -- $KEY_ARGS \
            -p $DROPBEAR_PORT $DROPBEAR_EXTRA_ARGS
        echo "$NAME."
        ;;
   stop)
        echo -n "Stopping $DESC: "
-       start-stop-daemon -K -x "$DAEMON"
+       start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
        echo "$NAME."
        ;;
   restart|force-reload)
        echo -n "Restarting $DESC: "
-       start-stop-daemon -K -x "$DAEMON"
+       start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
        sleep 1
        KEY_ARGS=""
        test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
        test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
-       start-stop-daemon -S \
+       start-stop-daemon -S -p $PIDFILE \
          -x "$DAEMON" -- $KEY_ARGS \
            -p $DROPBEAR_PORT $DROPBEAR_EXTRA_ARGS
        echo "$NAME."