dropbear: use pidfile for daemon start/stop/restart
Old init script killed all dropbear processes when doing stop/restart including open SSH sessions which is very annoying. (From OE-Core rev: 97aa5ac2df7593e343d82f5e64a422bb951eacf9) Signed-off-by: Roman I Khimov <khimov@altell.ru> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
c677b7c5c3
commit
5da2485717
|
@ -15,6 +15,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
DAEMON=/usr/sbin/dropbear
|
DAEMON=/usr/sbin/dropbear
|
||||||
NAME=dropbear
|
NAME=dropbear
|
||||||
DESC="Dropbear SSH server"
|
DESC="Dropbear SSH server"
|
||||||
|
PIDFILE=/var/run/dropbear.pid
|
||||||
|
|
||||||
DROPBEAR_PORT=22
|
DROPBEAR_PORT=22
|
||||||
DROPBEAR_EXTRA_ARGS=
|
DROPBEAR_EXTRA_ARGS=
|
||||||
|
@ -80,24 +81,24 @@ case "$1" in
|
||||||
KEY_ARGS=""
|
KEY_ARGS=""
|
||||||
test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
|
test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
|
||||||
test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
|
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 \
|
-x "$DAEMON" -- $KEY_ARGS \
|
||||||
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
|
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Stopping $DESC: "
|
echo -n "Stopping $DESC: "
|
||||||
start-stop-daemon -K -x "$DAEMON"
|
start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
restart|force-reload)
|
restart|force-reload)
|
||||||
echo -n "Restarting $DESC: "
|
echo -n "Restarting $DESC: "
|
||||||
start-stop-daemon -K -x "$DAEMON"
|
start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
|
||||||
sleep 1
|
sleep 1
|
||||||
KEY_ARGS=""
|
KEY_ARGS=""
|
||||||
test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
|
test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
|
||||||
test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
|
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 \
|
-x "$DAEMON" -- $KEY_ARGS \
|
||||||
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
|
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
|
|
Loading…
Reference in New Issue