Last active
December 24, 2015 08:19
-
-
Save DavidWittman/6769388 to your computer and use it in GitHub Desktop.
Init script to bring up Open vSwitch bridges at boot time on Ubuntu/Debian
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 | |
# | |
# openvswitch-bridges | |
# | |
# Brings up Open vSwitch bridges at boot time on Ubuntu/Debian. | |
# Needs to start _after_ the OVS services. This usually works: | |
# | |
# update-rc.d openvswitch-bridges defaults 21 | |
# | |
### BEGIN INIT INFO | |
# Provides: openvswitch-bridges | |
# Required-Start: openvswitch-switch | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: ifups OVS bridges at boot | |
### END INIT INFO | |
NETWORK_CONFIG_FILE="/etc/network/interfaces" | |
start() { | |
BRIDGES=$(ovs-vsctl list-br) | |
for BRIDGE in $BRIDGES; do | |
if grep -q -w "$BRIDGE" $NETWORK_CONFIG_FILE; then | |
ifup "$BRIDGE" | |
fi | |
done | |
} | |
case $1 in | |
start) | |
start | |
;; | |
stop) | |
;; | |
*) | |
echo "Usage: $0 {start}" | |
exit 2 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment