[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Debian 4.0 on VMware Player 2.0.5 on WinXP Pro SP3 keybounce, network, clock issues



debian-user:

Blindly calling ifdown/ifup from /etc/rc.local was cheesy, and sure enough it
didn't work reliably.  So I wrote a Bash shell script to ping my gateway and do
ifdown/ifup only if needed (three times maximum).  I call that from rc.local
instead:

    /root/bin/kick-eth0


David


#!/bin/bash
#######################################################################
# $Id: kick-eth0,v 1.2 2008/09/01 03:13:47 dpchrist Exp $
#
# Wake up interface eth0 as a work-around on Debian GNU/Linux virtual
# machines running under VMware Player.  Called by /etc/rc.local.
#
# Copyright 2008 by David Paul Christensen dpchrist@holgerdanske.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
# USA.
#######################################################################

IFDOWN="ifdown eth0"
IFUP="ifup eth0"
PING="ping -c 1 192.168.0.1"

declare -i tries=3

while true
do
    echo "$0: running '$PING'..."
    $PING
    ES=$?

    if [ $ES = 0 ]
    then
        echo "$0: eth0 is operational"
        break
    fi

    echo "$0: attempting to wake up eth0"

    tries=tries-1

    if [ $(( $tries <= 0 )) = 1 ]
    then
        echo "$0: ERROR unable to wake up eth0"
        exit 1
    fi

    echo "$0: running '$IFDOWN'..."
    $IFDOWN

    sleep 1

    echo "$0: running '$IFUP'..."
    $IFUP
done

#######################################################################


Reply to: