Created
May 4, 2012 16:16
-
-
Save adlorenz/2595849 to your computer and use it in GitHub Desktop.
A script for those fed up with iwlwifi's "Hardware restart was requested" every now and then
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
# This is a script which tackles iwlwifi wireless adapter silent deaths, | |
# to which the only remedy is either wait ages or reload iwlwifi module. | |
# This problem is getting on my nerves for quite a while now, hence the | |
# script. Google for "Hardware restart was requested" to get the idea. | |
# Cronjob excerpt: | |
# * * * * * root /usr/local/bin/fucking-wireless-watchdog.py > /tmp/fucking-wireless-watchdog.log | |
fucking_message_to_watch = 'Hardware restart was requested' | |
p = os.popen('dmesg | tail | grep "%s"' % fucking_message_to_watch, 'r') | |
l = p.readline() | |
if l.find(fucking_message_to_watch) is not -1: | |
print 'FFS, restart fucking wireless!' | |
os.system('/usr/bin/wall "Fucking wireless is down!"') | |
os.system('/sbin/rmmod iwlwifi; /bin/sleep 3; /sbin/modprobe iwlwifi') | |
else: | |
print 'False fucking alarm, carry on!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment