[Raspberry Pi] USB wireless network card automatically connected
When the Raspberry Pi uses a USB wireless network card, it will not be dropped because the route is restarted.
#! /Bin/bash
While true; do
If ifconfig wlan0 | grep-q "inet addr:"; then
Sleep 60
Else
Echo "Network connection down! Attempting reconnection ."
Ifup -- force wlan0
Sleep 10
Fi
Done
------ Evil split line -----
#! /Bin/bash
If ifconfig wlan0 | grep-q "inet addr:"; then
Exit
Else
Echo "Network connection down! Attempting reconnection ."
Ifup -- force wlan0
Fi
# Crontab-e
#*/10 * bash/home/network-monitor.sh # Run Once every 10 minutes
Copy the code to your root directory and save it as a network-monitor.sh and then run the command.
Sudo chmod + x./network-monitor.sh
Set it to an executable file and run the command in the background.
Sudo./network-monitor.sh &
It checks every 60 seconds if your wireless network has a network connection. If it finds that it does not have a network address, it will try to force a new connection and continue this operation until the connection is established again. If you want to prevent it from running in the background, first use the following command.
Fg
It will force it to run for the foreground, and then you can use ctrl-c to stop.
It has been tested in several aspects.
First, close my WiFi access point. This script does not detect network connections and begins to try to force a connection. After several minutes, connect the power supply access point again.
In another experiment, I deleted the MAC address from the address list and allowed the MAC address filtering of the Access Point. After the network is connected, the re-enabled MAC address and it will return in one or two minutes.
How to run Ubuntu Snappy Core in Raspberry Pi 2
Install NodeJS on the (Raspberry Pi) Raspberry Pi
Install Weston on Raspberry Pi
Linux OS for Raspberry Pi is available
Raspberry Pi (Raspberry Pi) trial note
Introduction to Raspberry Pi (Raspberry Pi) installation, IP configuration, and software source
This article permanently updates the link address: