Created
September 14, 2012 16:15
-
-
Save jdutton/3722959 to your computer and use it in GitHub Desktop.
Demo script to set arp notify after restoration of network link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script ensures that the correct sysctl is configured on the | |
# installed guest. This is needed to fix case 20602. | |
# Reboot the guest regardless of whether we take any action here. | |
GARP_ENABLE="net.ipv4.conf.default.arp_notify = 1" | |
SYSCTL_FILE="/etc/sysctl.conf" | |
if [ -e $SYSCTL_FILE ] | |
then | |
grep -q "$GARP_ENABLE" $SYSCTL_FILE | |
if [ $? != 0 ] | |
then | |
echo stuffing $GARP_ENABLE into $SYSCTL_FILE | |
echo >> $SYSCTL_FILE | |
echo "# Configure to send gARP after migration" >> $SYSCTL_FILE | |
echo "$GARP_ENABLE" >> $SYSCTL_FILE | |
else | |
echo $GARP_ENABLE already found in $SYSCTL_FILE | |
sysctl -a | grep -q "$GARP_ENABLE" | |
if [ $? != 0 ] | |
then | |
echo sysctl is not working - "$GARP_ENABLE" not found | |
fi | |
fi | |
else | |
echo system does not have $SYSCTL_FILE -- nothing to do | |
fi | |
echo rebooting now | |
shutdown -r now |
I'm going to modify this to take a --reboot argument (which automated test will supply) so that it operates as expected when run by test. In interactive (default) mode, it'll prompt every step of the way.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The reboot should really prompt the user first and allow him to decline to reboot now.