2009-07-08 13:19:16 -07:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
2011-06-17 12:24:31 -07:00
|
|
|
# Copyright (C) 2011 Nicira Networks, Inc.
|
2009-07-08 13:19:16 -07:00
|
|
|
#
|
2011-06-17 12:24:31 -07:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at:
|
2009-07-08 13:19:16 -07:00
|
|
|
#
|
2011-06-17 12:24:31 -07:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2009-07-08 13:19:16 -07:00
|
|
|
#
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: openvswitch-switch
|
|
|
|
# Required-Start: $network $named $remote_fs $syslog
|
2010-03-31 17:42:50 -07:00
|
|
|
# Required-Stop: $remote_fs
|
2009-07-08 13:19:16 -07:00
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
# Short-Description: Open vSwitch switch
|
|
|
|
### END INIT INFO
|
|
|
|
|
2011-06-17 12:24:31 -07:00
|
|
|
(test -x /usr/sbin/ovs-vswitchd && test -x /usr/bin/ovsdb-server) || exit 0
|
2010-01-15 13:09:32 -08:00
|
|
|
|
2011-06-17 12:24:31 -07:00
|
|
|
test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
|
2011-02-07 11:44:54 -08:00
|
|
|
|
2011-06-17 12:24:31 -07:00
|
|
|
ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl
|
2010-01-15 13:09:32 -08:00
|
|
|
|
2011-06-17 16:24:54 -07:00
|
|
|
start () {
|
|
|
|
set $ovs_ctl ${1-start} --system-id=random
|
|
|
|
if test X"$FORCE_COREFILES" != X; then
|
|
|
|
set "$@" --force-corefiles="$FORCE_COREFILES"
|
|
|
|
fi
|
2011-06-21 16:40:44 -07:00
|
|
|
"$@" || exit $?
|
2010-03-30 02:10:37 -07:00
|
|
|
|
2011-06-21 16:40:44 -07:00
|
|
|
$ovs_ctl --protocol=gre enable-protocol
|
2011-06-17 16:24:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
stop () {
|
|
|
|
$ovs_ctl stop
|
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
2011-06-17 12:24:31 -07:00
|
|
|
stop | force-stop)
|
2011-06-17 16:24:54 -07:00
|
|
|
stop
|
2009-07-08 13:19:16 -07:00
|
|
|
;;
|
2011-06-17 12:24:31 -07:00
|
|
|
reload | force-reload)
|
|
|
|
# The OVS daemons keep up-to-date.
|
2010-01-11 15:31:14 -08:00
|
|
|
;;
|
2009-07-08 13:19:16 -07:00
|
|
|
restart)
|
2011-06-17 16:24:54 -07:00
|
|
|
stop
|
|
|
|
start
|
2010-01-11 15:31:14 -08:00
|
|
|
;;
|
2009-07-08 13:19:16 -07:00
|
|
|
status)
|
2011-06-17 12:24:31 -07:00
|
|
|
$ovs_ctl status
|
2009-07-08 13:19:16 -07:00
|
|
|
;;
|
2011-06-17 16:24:54 -07:00
|
|
|
force-reload-kmod)
|
|
|
|
start force-reload-kmod
|
|
|
|
;;
|
2009-07-08 13:19:16 -07:00
|
|
|
*)
|
2011-06-17 16:24:54 -07:00
|
|
|
echo "Usage: $0 {start|stop|restart|force-reload|status|force-stop|force-reload-kmod}" >&2
|
2010-01-11 15:31:14 -08:00
|
|
|
exit 1
|
|
|
|
;;
|
2009-07-08 13:19:16 -07:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|