]> git.proxmox.com Git - ovs.git/blob - rhel/etc_init.d_openvswitch
Add RHEL 5/6 spec files and instructions.
[ovs.git] / rhel / etc_init.d_openvswitch
1 #!/bin/sh
2 #
3 # openvswitch
4 #
5 # chkconfig: 2345 09 91
6 # description: Manage Open vSwitch kernel modules and user-space daemons
7
8 # Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
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
22 # Provides: openvswitch-switch
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
30 . /usr/share/openvswitch/scripts/ovs-lib.sh || exit 1
31 test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
32
33 start () {
34 # Allow GRE traffic.
35 /sbin/iptables -I INPUT -p gre -j ACCEPT
36
37 set $ovs_ctl ${1-start}
38 set "$@" --system-id=random
39 if test X"$FORCE_COREFILES" != X; then
40 set "$@" --force-corefiles="$FORCE_COREFILES"
41 fi
42 if test X"$OVSDB_SERVER_PRIORITY" != X; then
43 set "$@" --ovsdb-server-priority="$OVSDB_SERVER_PRIORITY"
44 fi
45 if test X"$VSWITCHD_PRIORITY" != X; then
46 set "$@" --ovs-vswitchd-priority="$VSWITCHD_PRIORITY"
47 fi
48 if test X"$VSWITCHD_MLOCKALL" != X; then
49 set "$@" --mlockall="$VSWITCHD_MLOCKALL"
50 fi
51 if test ! -e /var/run/openvswitch.booted; then
52 touch /var/run/openvswitch.booted
53 set "$@" --delete-bridges
54 fi
55 "$@"
56
57 touch /var/lock/subsys/openvswitch
58 }
59
60 stop () {
61 $ovs_ctl stop
62 rm -f /var/lock/subsys/openvswitch
63 }
64
65 ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl
66 case $1 in
67 start)
68 start
69 ;;
70 stop)
71 stop
72 ;;
73 restart)
74 stop
75 start
76 ;;
77 reload|force-reload)
78 # Nothing to do.
79 ;;
80 status)
81 $ovs_ctl status
82 ;;
83 version)
84 $ovs_ctl version
85 ;;
86 force-reload-kmod)
87 start force-reload-kmod
88 ;;
89 help)
90 printf "$0 [start|stop|restart|reload|force-reload|status|version|force-reload-kmod]\n"
91 ;;
92 *)
93 printf "Unknown command: $1\n"
94 exit 1
95 ;;
96 esac