#!/bin/bash

# Attempt to start eth0 first

started=0

if /etc/init.d/net.eth0 status | grep "started" >/dev/null ; then
	started=1
fi

if test "${started}" = "1" ; then
	/etc/init.d/net.eth0 restart
else
	/etc/init.d/net.eth0 start
fi

# If that failed, try wireless
if /etc/init.d/net.eth0 status | grep "stopped" >/dev/null ; then
	
	modprobe eth1

	started=0

	if /etc/init.d/net.eth1 status | grep "started" >/dev/null ; then
		started=1
	fi

	if test "${started}" = "1" ; then
		/etc/init.d/net.eth1 restart
	else
		/etc/init.d/net.eth1 start
	fi
fi