fff-vpn-select: improve logic for fastd start/stop
The start/stop part of fff-vpn-select currently uses a subshell for what is meant to be logic grouping. Address that by swapping condition levels and add comment to explain what is actually done. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
4f76367b5a
commit
dadde41b3c
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-vpn-select
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=6
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
|
|
@ -52,10 +52,12 @@ if [ -s "$hoodfile" ]; then
|
|||
|
||||
# fastd start/stop for various situations
|
||||
pidfile="/tmp/run/fastd.fff.pid"
|
||||
if [ "$(ls /etc/fastd/fff/peers/* 2>/dev/null)" ]; then
|
||||
([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) || /etc/init.d/fastd start
|
||||
if [ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]; then
|
||||
# Stop if service is running but no peers present
|
||||
[ "$(ls /etc/fastd/fff/peers/* 2>/dev/null)" ] || /etc/init.d/fastd stop
|
||||
else
|
||||
([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) && /etc/init.d/fastd stop
|
||||
# Start if service is not running but peers are present
|
||||
[ "$(ls /etc/fastd/fff/peers/* 2>/dev/null)" ] && /etc/init.d/fastd start
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue