Skip to content

Instantly share code, notes, and snippets.

@malud
Created October 18, 2014 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malud/1cbf960ac19a58db7111 to your computer and use it in GitHub Desktop.
Save malud/1cbf960ac19a58db7111 to your computer and use it in GitHub Desktop.
preventing the raspberry pi wlan stick goes to sleep
#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
#!/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