Skip to content

Instantly share code, notes, and snippets.

@DavidWittman
Last active December 24, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidWittman/6769388 to your computer and use it in GitHub Desktop.
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
#!/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