WireGuard: delayed service update to avoid race condition

This commit is contained in:
bergware
2023-06-24 09:53:51 +02:00
parent b186761ee7
commit 0dc226b0c9
2 changed files with 4 additions and 9 deletions

View File

@@ -1,8 +1,6 @@
#!/bin/bash
job=/tmp/wgjob.tmp
reload=/usr/local/emhttp/webGui/scripts/reload_services
lock=/tmp/atlock.tmp
rm -f $job
echo "sleep 5;$reload $job"|at -M now 2>/dev/null
rm -f $lock
echo "sleep ${1:-1};/usr/local/emhttp/webGui/scripts/reload_services $lock"|at -M now 2>/dev/null
exit 0

View File

@@ -11,8 +11,6 @@
ini=/var/local/emhttp/network.ini.new
cfg=/boot/config/network.cfg
job=/tmp/atjob.tmp
reload=/usr/local/emhttp/webGui/scripts/reload_services
declare -A VLANID USE_DHCP IPADDR NETMASK GATEWAY METRIC USE_DHCP6 IPADDR6 NETMASK6 GATEWAY6 PRIVACY6 METRIC6 DESCRIPTION PROTOCOL
@@ -222,8 +220,7 @@ done
/usr/bin/mv $ini ${ini%.*}
# delayed execution
rm -f $job
echo "sleep 35;$reload $job"|at -M now 2>/dev/null
/usr/local/emhttp/webGui/scripts/update_services 35
# send update information
if [[ -n $interface && -n $data && -e /var/run/nginx.socket ]]; then