Morphex's blogologue (Life, technology, music, politics, business, mental health and more)

This is the blog of Morten W. Petersen, aka. morphex in various places. I blog about my life, and what I find interesting and/or important. This is a personal blog without any editor or a lot of oversight so treat it as such. :)

My email is morphex@gmail.com.

An OGG/Vorbis player, implemented in Javascript.

My Kiva bragging page
My shared (open source) code on GitHub

Morphex's Blogodex

News
Slashdot

Zope hosting by Nidelven IT

Morten Petersen on Linkedin

Morten Petersen on Facebook

Morten Petersen on SoundCloud

Morten Petersen on MixCloud

Blogologue on Twitter



Older entries



Atom - Subscribe - Categories

Facebook icon Share on Facebook Google+ icon Share on Google+ Twitter icon Share on Twitter LinkedIn icon Share on LinkedIn

Script to setup WiFi at boot

So, I've got a computer I can't easily access, so I have to set it up to use WiFi at boot. Different configuration options on different Linux distributions give unpredictable results. Today I also experienced a lot of dropped connections, so I had to add a test for network connectivity and setup part of the connection when it drops.

Here's the script, it is also available on https://blogologue.com/wpas.sh

#!/bin/bash
# Crontab entry: @reboot /root/wpas.sh
# Uncomment to kill any wpa_supplicant processes started automatically
#/usr/bin/killall wpa_supplicant
/sbin/wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf &> /root/wpas.log &
/bin/sleep 5
while :
do
/bin/ping -c 2 blogologue.com
if [ $? -eq 2 ]
then
/usr/bin/killall -q dhclient
/bin/sleep 5s
/sbin/dhclient wlan0
fi
/bin/sleep 5
done




[Permalink] [By morphex] [Linux (Atom feed)] [23 Jan 15:09 Europe/Oslo]