fastd-start-stop-fix #221
|
@ -1,7 +1,7 @@
|
|||
protocol=fastd
|
||||
|
||||
fastd_clear() {
|
||||
rm /tmp/fastd_fff_peers/*
|
||||
rm /tmp/fastd_fff_peers/* 2>/dev/null
|
||||
|
||||
}
|
||||
|
||||
fastd_addpeer() {
|
||||
|
@ -21,14 +21,9 @@ fastd_addpeer() {
|
|||
}
|
||||
|
||||
fastd_start_stop() {
|
||||
/etc/init.d/fastd reload # does nothing if fastd was not running
|
||||
|
||||
# fastd start/stop for various situations
|
||||
# this is needed for first start and if fastd comes up or disappears in hoodfile
|
||||
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 ls /etc/fastd/fff/peers/* &>/dev/null; then
|
||||
/etc/init.d/fastd reload
|
||||
else
|
||||
([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) && /etc/init.d/fastd stop
|
||||
/etc/init.d/fastd stop
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -24,19 +24,21 @@ done
|
|||
|
||||
# configure vpn
|
||||
|
||||
if [ -n "$hoodfile" ] && [ -s "$hoodfile" ] ; then
|
||||
json_load "$(cat "$hoodfile")"
|
||||
json_select hood
|
||||
json_get_var id id
|
||||
json_select ".."
|
||||
json_select vpn
|
||||
json_get_keys vpn_keys
|
||||
for key in $vpn_keys; do
|
||||
json_select $key
|
||||
json_get_var protocol protocol
|
||||
"${protocol}_addpeer"
|
||||
json_select ".." # back to vpn
|
||||
done
|
||||
if [ "$0" != "/usr/sbin/vpn-stop" ] ; then
|
||||
if [ -n "$hoodfile" ] && [ -s "$hoodfile" ] ; then
|
||||
json_load "$(cat "$hoodfile")"
|
||||
json_select hood
|
||||
json_get_var id id
|
||||
json_select ".."
|
||||
json_select vpn
|
||||
json_get_keys vpn_keys
|
||||
for key in $vpn_keys; do
|
||||
json_select $key
|
||||
json_get_var protocol protocol
|
||||
"${protocol}_addpeer"
|
||||
json_select ".." # back to vpn
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# start/restart/stop vpnservices
|
||||
|
|
Loading…
Reference in New Issue
Ich würde hier wohl eher
rm -f <files..>
verwenden, statt 2>/dev/null.ja ist huebscher.