diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 5c743898a..abc718d0c 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -8,11 +8,13 @@ Before=dhcpcd.service Before=network.target [Service] -Type=idle +Type=forking +Restart=on-failure +RestartSec=2 PIDFile=/run/hostapd.pid ExecStartPre=-/sbin/iw phy phy0 interface add ap0 type __ap ExecStartPre=-/sbin/ip link set ap0 address {{ ap0_mac_addr }} -ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf +ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostapd.conf ExecStartPost=-/sbin/ip link set ap0 up ExecStopPost=-/sbin/iw dev ap0 del