updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / openvswitch-git / openvswitch-git.init
blobf6952eebc09c5e5d5c3c2b307754b758b6a2235b
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 OVS_DB_PID_FILE=/var/run/openvswitch/ovsdb-server.pid
7 OVS_VS_PID_FILE=/var/run/openvswitch/ovs-vswitchd.pid
8 OVS_BC_PID_FILE=/var/run/openvswitch/ovs-brcompatd.pid
10 case "$1" in
11 start)
13 stat_busy "Starting OpenVSwitch DB server"
14 /usr/sbin/ovsdb-server /etc/openvswitch/ovs-vswitchd.conf.db \
15 --remote=punix:/var/run/openvswitch/db.sock \
16 --remote=db:Open_vSwitch,manager_options \
17 --private-key=db:SSL,private_key \
18 --certificate=db:SSL,certificate \
19 --bootstrap-ca-cert=db:SSL,ca_cert \
20 --pidfile=${OVS_DB_PID_FILE} \
21 --detach
22 if [ $? -gt 0 ]; then
23 stat_fail
24 else
25 stat_done
28 stat_busy "Starting openvswitch daemon"
29 /usr/sbin/ovs-vswitchd unix:/var/run/openvswitch/db.sock \
30 --pidfile=${OVS_VS_PID_FILE} \
31 --detach \
32 --monitor
33 if [ $? -gt 0 ]; then
34 stat_fail
35 else
36 stat_done
39 stat_busy "Starting openvswitch bridge compatibility"
40 ovs-brcompatd --pidfile=${OVS_BC_PID_FILE} --detach
41 if [ $? -gt 0 ]; then
42 stat_fail
43 else
44 stat_done
47 chgrp ovs /var/run/openvswitch/*
48 chmod g+rw /var/run/openvswitch/*
50 add_daemon openvswitch
52 stop)
53 stat_busy "Stopping openvswitch bridge compatibility"
54 kill $(< ${OVS_BC_PID_FILE}) &> /dev/null
55 if [ $? -gt 0 ]; then
56 stat_fail
57 else
58 stat_done
60 rm ${OVS_BC_PID_FILE} &> /dev/null
62 stat_busy "Stopping openvswitch daemon"
63 kill $(< ${OVS_VS_PID_FILE}) &> /dev/null
64 if [ $? -gt 0 ]; then
65 stat_fail
66 else
67 stat_done
69 rm ${OVS_VS_PID_FILE} &> /dev/null
71 stat_busy "Stopping openvswitch DB server"
72 kill $(< ${OVS_DB_PID_FILE}) &> /dev/null
73 if [ $? -gt 0 ]; then
74 stat_fail
75 else
76 stat_done
78 rm_daemon openvswitch
80 restart)
81 $0 stop
82 sleep 1
83 $0 start
86 echo "usage: $0 {start|stop|restart}"
87 esac
88 exit 0