2017-05-22 2 views
0

ce code est en cours d'exécution sur un PI3 framboiseessayer de démarrer/usr/sbin/hostapd dans un script conditionnel

i ont un script /etc/rc2.d/S05frameapp qui commence conditionnellement hostapd (regarde pour voir si wifi a été mis en place ou non)

dans le script (cette section s'exécuter si aucune connexion Wi-Fi est jeu d'installation pour cet appareil)

echo "restarting etho" 
/sbin/ifup wlan0 

echo "Starting hostapd"; 
/usr/bin/nohup /usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf >> /tmp/hostapd.log 2>&1 & 

echo "Starting dnsmasq "; 
/usr/sbin/service dnsmasq start; 

echo "Starting wifi_config node"; 
cd /home/wifi_listener/ 
/usr/bin/nohup /usr/local/bin/node app.js >> /tmp/nodeapp.log 2>&1 & 

du nohup, dans le /tmp/hostapd.log je vois

cat /tmp/hostapd.log 
Configuration file: /etc/hostapd/hostapd.conf 
Failed to create interface mon.wlan0: -95 (Operation not supported) 
Could not set channel for kernel driver 
Interface initialization failed 
wlan0: interface state UNINITIALIZED->DISABLED 
wlan0: AP-DISABLED 
wlan0: Unable to setup interface. 
hostapd_free_hapd_data: Interface wlan0 wasn't started 

mais si je maintenant vous connecter (via le réseau câblé) et exécutez la commande suivante il fonctionne ...

#/usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf 
Configuration file: /etc/hostapd/hostapd.conf 
Failed to create interface mon.wlan0: -95 (Operation not supported) 
wlan0: Could not connect to kernel driver 
Using interface wlan0 with hwaddr b8:27:eb:40:bd:a4 and ssid 
"WhatUlooknAtWillis" 
wlan0: interface state UNINITIALIZED->ENABLED 
wlan0: AP-ENABLED 

donc je pense kinfod cela peut être un problème de synchronisation? c'est pourquoi j'ai actuellement exécuter le script S05

Merci pour toute aide

Répondre

1

Je trouve la question. il est l'ordre de départ hostapd et dnsmasq

le correctif est que vous devez commencer Dnsmasq d'abord, puis commencer hostapd

echo "Starting dnsmasq "; 
/usr/sbin/service dnsmasq start 

echo "Starting hostapd"; 
/usr/bin/nohup /usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf >> /tmp/hostapd.log 2>&1 &