Initial commit.

This commit is contained in:
root 2014-08-27 07:39:40 +00:00
parent bf90d8f290
commit edaa8362cd
3 changed files with 25 additions and 0 deletions

8
install.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
echo "Installing wifi reset service to /opt/wifi-reset."
mkdir -p /opt/wifi-reset
cp -f wifi-reset.sh /opt/wifi-reset/wifi-reset.sh
echo "Installing systemd service to run at boot."
cp -f wifi-reset.service /lib/systemd/system/wifi-reset.service
echo "Enabling systemd service."
systemctl enable wifi-reset.service > /dev/null

10
wifi-reset.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=Wireless Network Reset
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/bash /opt/wifi-reset/wifi-reset.sh
[Install]
WantedBy=multi-user.target

7
wifi-reset.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
# Bring all wifi interfaces down.
# Identify wifi interfaces as rows from standard output of iwconfig (NOT standard
# error, those are non-wifi interfaces) which start without whitespace.
iwconfig 2> /dev/null | grep -o '^[[:alnum:]]\+' | while read x; do ifdown $x; done
# Bring all wifi interfaces up.
iwconfig 2> /dev/null | grep -o '^[[:alnum:]]\+' | while read x; do ifup $x; done