#!/bin/sh

INTERFACE=3g-3G

# We have to protect vnstat's database from bad data due to nonexistent interfaces

# Make sure the interface is up
#/sbin/ifconfig $INTERFACE | grep UP 1>/dev/null 2>/dev/null && {
# If the interface is up, make sure it's finished IP negotiations
# /sbin/ifconfig $INTERFACE | grep inet 1>/dev/null 2>/dev/null && /usr/bin/vnstat -u -i $INTERFACE
#   } 

if [ -f /tmp/.vnstat-safe-updates ] ; then {
 /usr/bin/vnstat -u -i $INTERFACE
 }
fi
