ap_start () { service hostapd restart service dnsmasq restart iptables-restore < /etc/iptables.ipv4.nat } ap_stop () { service hostapd stop service dnsmasq stop iptables-restore < /etc/iptables.ipv4.nonat } if [ "$interface" = wlan0 ]; then case "$reason" in PREINIT) (sleep 3; ap_start > /dev/null 2>&1) & ;; DEPARTED) (sleep 3; ap_stop > /dev/null 2>&1) & ;; esac fi if $if_up; then (sleep 3; chronyc online > /dev/null 2>&1) & fi