#!/bin/sh /etc/rc.common # # Copyright (c) 2017 Qualcomm Technologies, Inc. # # All Rights Reserved. # Confidential and Proprietary - Qualcomm Technologies, Inc. # # Copyright (c) 2016, The Linux Foundation. All rights reserved. # START=15 boot() { if [ -e "/var/run/hostapd-global.pid" ] then kill $(cat /var/run/hostapd-global.pid) &> /dev/null rm /var/run/hostapd-global.pid &> /dev/null fi hostapd -g /var/run/hostapd/global -B -P /var/run/hostapd-global.pid ($initscript monitor&) } # monitor hostapd and restart with wifi if it crashed monitor() { exec &>/dev/null while sleep 5; do if [ -e /var/run/hostapd-global.pid ] && wpa_cli -g /var/run/hostapd/global ping; then continue fi wifi down $initscript boot sleep 5 wifi & break done } EXTRA_COMMANDS="${EXTRA_COMMANDS} monitor"