Created
October 18, 2014 07:03
-
-
Save malud/1cbf960ac19a58db7111 to your computer and use it in GitHub Desktop.
preventing the raspberry pi wlan stick goes to sleep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#steps to prepare heartbeat script | |
#assuming that you use the Edimax EW-7811Un | |
sudo nano /etc/modprobe.d/8192cu.conf | |
#add the following lines | |
# Disable power management | |
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0 | |
# make executable chmod +x /path/to/heartbeat_script | |
#finally make a cronjob e.g. all 30 minutes | |
crontab -e | |
30 * * * * sudo sh ~/cronjobs/wlan_heartbeat.sh >/dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check if a wlan0 if exists | |
if echo `ifplugstatus -a` | grep -E 'wlan0' $1; then | |
#check if there is IP Address | |
if echo `ifconfig $1` | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"; then | |
exit 0 | |
fi | |
modprobe -r 8192cu | |
fi | |
modprobe 8192cu | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment