]> git.proxmox.com Git - mirror_ovs.git/blame - rhel/etc_init.d_openvswitch
treewide: Convert leading tabs to spaces.
[mirror_ovs.git] / rhel / etc_init.d_openvswitch
CommitLineData
c434706a
BP
1#!/bin/sh
2#
3# openvswitch
4#
5# chkconfig: 2345 09 91
6# description: Manage Open vSwitch kernel modules and user-space daemons
7
f2073881 8# Copyright (C) 2009, 2010, 2011, 2013 Nicira, Inc.
c434706a
BP
9#
10# Licensed under the Apache License, Version 2.0 (the "License");
11# you may not use this file except in compliance with the License.
12# You may obtain a copy of the License at:
13#
14# http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing, software
17# distributed under the License is distributed on an "AS IS" BASIS,
18# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19# See the License for the specific language governing permissions and
20# limitations under the License.
21### BEGIN INIT INFO
8d7bc3f8 22# Provides: openvswitch
c434706a
BP
23# Required-Start:
24# Required-Stop:
25# Default-Start: 2 3 4 5
26# Default-Stop: 0 1 6
27# Short-Description: Open vSwitch switch
28### END INIT INFO
29
f28cae87
GS
30SYSTEMCTL_SKIP_REDIRECT=yes
31
d422c118 32. /usr/share/openvswitch/scripts/ovs-lib || exit 1
c434706a
BP
33test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
34
35start () {
46528f78 36 set ovs_ctl ${1-start}
c434706a
BP
37 set "$@" --system-id=random
38 if test X"$FORCE_COREFILES" != X; then
5a0e4aec 39 set "$@" --force-corefiles="$FORCE_COREFILES"
c434706a
BP
40 fi
41 if test X"$OVSDB_SERVER_PRIORITY" != X; then
5a0e4aec 42 set "$@" --ovsdb-server-priority="$OVSDB_SERVER_PRIORITY"
c434706a
BP
43 fi
44 if test X"$VSWITCHD_PRIORITY" != X; then
5a0e4aec 45 set "$@" --ovs-vswitchd-priority="$VSWITCHD_PRIORITY"
c434706a
BP
46 fi
47 if test X"$VSWITCHD_MLOCKALL" != X; then
5a0e4aec 48 set "$@" --mlockall="$VSWITCHD_MLOCKALL"
c434706a 49 fi
87378a87 50 set "$@" $OVS_CTL_OPTS
c434706a
BP
51 "$@"
52
53 touch /var/lock/subsys/openvswitch
54}
55
56stop () {
46528f78 57 ovs_ctl stop
c434706a
BP
58 rm -f /var/lock/subsys/openvswitch
59}
60
aad12c5f
GS
61restart () {
62 if [ "$1" = "--save-flows=yes" ]; then
63 start restart
64 else
65 stop
66 start
67 fi
68}
69
c434706a
BP
70case $1 in
71 start)
72 start
73 ;;
74 stop)
75 stop
76 ;;
77 restart)
aad12c5f
GS
78 shift
79 restart "$@"
c434706a
BP
80 ;;
81 reload|force-reload)
82 # Nothing to do.
83 ;;
84 status)
46528f78 85 ovs_ctl status
f2073881 86 exit $?
c434706a
BP
87 ;;
88 version)
46528f78 89 ovs_ctl version
c434706a
BP
90 ;;
91 force-reload-kmod)
92 start force-reload-kmod
93 ;;
94 help)
95 printf "$0 [start|stop|restart|reload|force-reload|status|version|force-reload-kmod]\n"
96 ;;
97 *)
98 printf "Unknown command: $1\n"
99 exit 1
100 ;;
101esac