aboutsummaryrefslogtreecommitdiff
path: root/files/bin/ifcheck
blob: c66f2adc950cd4b71b0a0d416764eca067955638 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
#
# Check if a network interface is up, fixing if needed.
#

# Parameters
BASENAME="`basename $0`"
IFACE="$1"

# Syntax check
if [ -z "$IFACE" ]; then
  echo "usage: $BASENAME <interface>"
  exit 1
fi

# Run
if ! LANG=C LC_ALL=C ifconfig $IFACE | grep -q "inet addr:"; then
  ifup --force $IFACE
fi