Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sudo nano /root/autoreconnect.sh
- ***
- #!/bin/bash
- interface='wlan0'
- while true ; do
- if ifconfig $interface | grep -q "inet addr:" ; then
- echo "Network is working"
- sleep 60
- else
- echo "Network connection down! Attempting reconnection."
- systemctl restart networking.service
- ifup --force $interface
- sleep 10
- fi
- done
- *** Ctrl+O Ctrl+X
- sudo chmod +x /root/autoreconnect.sh
- sudo nano /lib/systemd/system/autoreconnect.service
- ***
- [Unit]
- Description=Autoreconnect wlan0 on Raspberry
- [Service]
- ExecStart=/root/autoreconnect.sh
- StandardOutput=null
- [Install]
- WantedBy=multi-user.target
- Alias=autoreconnect.service
- *** Ctrl+O Ctrl+X
- sudo systemctl enable autoreconnect.service
- sudo systemctl start autoreconnect.service
- systemctl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement