wifi-reload: Initial version.

This commit is contained in:
Ole Tange 2017-04-23 11:30:52 +02:00
parent af3388783b
commit 028d0520cf
4 changed files with 74 additions and 7 deletions

2
G/G
View file

@ -4,7 +4,7 @@
=head1 NAME =head1 NAME
G - short hand for multi level greps G - shorthand for multi level greps
=head1 SYNOPSIS =head1 SYNOPSIS

View file

@ -1,8 +1,8 @@
CMD = blink bsearch em G gitnext goodpasswd histogram neno pdfman \ CMD = blink bsearch em field forever G gitnext goodpasswd histogram \
puniq ramusage rand rclean rn rrm stdout T timestamp tracefile \ neno pdfman puniq ramusage rand rclean rn rrm stdout T timestamp \
upsidedown wssh tracefile upsidedown w4it-for-port-open wifi-reload wssh
all: blink/blink.1 bsearch/bsearch.1 G/G.1 gitnext/gitnext.1 goodpasswd/goodpasswd.1 histogram/histogram.1 neno/neno.1 pdfman/pdfman.1 puniq/puniq.1 rand/rand.1 rn/rn.1 rrm/rrm.1 stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 T/T.1 upsidedown/upsidedown.1 wssh/wssh.1 all: blink/blink.1 bsearch/bsearch.1 G/G.1 gitnext/gitnext.1 goodpasswd/goodpasswd.1 histogram/histogram.1 neno/neno.1 pdfman/pdfman.1 puniq/puniq.1 rand/rand.1 rn/rn.1 rrm/rrm.1 stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 T/T.1 upsidedown/upsidedown.1 wifi-reload/wifi-reload.1 wssh/wssh.1
%.1: % %.1: %
pod2man $< > $@ pod2man $< > $@

View file

@ -115,8 +115,11 @@ else
fi fi
man -w "$@" | parallel 'zcat {} || cat {}' 2>/dev/null | man -w "$@" |
parallel 'zcat {} || cat {}' 2>/dev/null |
# Convert -- to - and '' to " # Convert -- to - and '' to "
(echo '.tr \--'; perl -pe "s/''|\`\`/\"\"/g;") | (echo '.tr \--'; perl -pe "s/''|\`\`/\"\"/g;") |
man -tl - | ps2pdf - >$pdf && pdfviewer $pdf man -tl - |
perl -pe "s/'/\\\\010/g" |
ps2pdf - >$pdf && pdfviewer $pdf
cleanup 2>/dev/null cleanup 2>/dev/null

64
wifi-reload/wifi-reload Executable file
View file

@ -0,0 +1,64 @@
#!/bin/bash
: <<=cut
=encoding utf8
=head1 NAME
wifi-reload - reload wifi setup
=head1 SYNOPSIS
B<wifi-reload>
=head1 DESCRIPTION
Sometimes the wifi config gets stuck. B<wifi-reload> tries to get the
config unstuck by reloading modules, wpa_supplicant and
NetworkManager.
=head1 AUTHOR
Copyright (C) 2017 Ole Tange,
http://ole.tange.dk and Free Software Foundation, Inc.
=head1 LICENSE
Copyright (C) 2012 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
at your option any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
=head1 SEE ALSO
B<bash>(1)
=cut
sudo killall wpa_supplicant
sudo parallel -j1 modprobe -r ::: iwldvm ath9k ath9k_common mac80211 ath9k_hw ath cfg80211 ath3k
sleep 1
sudo killall -9 wpa_supplicant
parallel -j1 sudo modprobe ::: ath9k ath9k_common mac80211 ath9k_hw ath cfg80211 ath3k iwldvm
PID=$(sudo NetworkManager 2>&1 | grep -Eo '[0-9]+')
sudo kill $PID || sudo killall NetworkManager
sleep 1
sudo kill -9 $PID
sudo NetworkManager &
forever dmesg | puniq