mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
added delay in process
This commit is contained in:
parent
57de9a98a5
commit
1caa09ac46
1 changed files with 19 additions and 4 deletions
23
setup.sh
23
setup.sh
|
|
@ -271,12 +271,27 @@ FirewallRuleSet preauthenticated-users {
|
||||||
RedirectURL http://10.0.252.1/static/index.html
|
RedirectURL http://10.0.252.1/static/index.html
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Restart services
|
# Restart services in the correct order and add delays to prevent race conditions
|
||||||
|
echo "Restarting services..."
|
||||||
sudo systemctl restart dhcpcd
|
sudo systemctl restart dhcpcd
|
||||||
sudo systemctl restart dnsmasq
|
|
||||||
sudo systemctl restart hostapd
|
sudo systemctl restart hostapd
|
||||||
if command -v nodogsplash &> /dev/null; then
|
|
||||||
sudo systemctl restart nodogsplash
|
# Wait for the interface to come up and get the IP address
|
||||||
|
echo "Waiting for wlan0 to be configured..."
|
||||||
|
sleep 5 # Give services a moment to start
|
||||||
|
|
||||||
|
# Check for the IP address before starting nodogsplash
|
||||||
|
IP_CHECK=$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
|
||||||
|
if [ "$IP_CHECK" == "10.0.252.1" ]; then
|
||||||
|
echo "✅ wlan0 configured with IP $IP_CHECK."
|
||||||
|
sudo systemctl restart dnsmasq
|
||||||
|
if command -v nodogsplash &> /dev/null; then
|
||||||
|
sudo systemctl restart nodogsplash
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ Error: wlan0 failed to get the static IP 10.0.252.1. Found: '$IP_CHECK'."
|
||||||
|
echo "Please check 'sudo systemctl status hostapd' and 'sudo systemctl status dhcpcd'."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "✅ WiFi hotspot and captive portal configured. SSID: TimeTurner, IP: 10.0.252.1"
|
echo "✅ WiFi hotspot and captive portal configured. SSID: TimeTurner, IP: 10.0.252.1"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue