updated on Thu Jan 19 04:14:35 UTC 2012
[aur-mirror.git] / openvswitch / openvswitch.init
blob42e5a8c3c1f7688397df341148f8328cc804e065
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
9 case "$1" in
10 start)
12 stat_busy "Starting OpenVSwitch DB server"
13 /usr/sbin/ovsdb-server /etc/openvswitch/ovs-vswitchd.conf.db \
14 --remote=punix:/var/run/openvswitch/db.sock \
15 --remote=db:Open_vSwitch,managers \
16 --private-key=db:SSL,private_key \
17 --certificate=db:SSL,certificate \
18 --bootstrap-ca-cert=db:SSL,ca_cert \
19 --pidfile=${OVS_DB_PID_FILE} \
20 --detach
21 if [ $? -gt 0 ]; then
22 stat_fail
23 else
24 stat_done
27 stat_busy "Starting Open vSwitch daemon"
28 /usr/sbin/ovs-vswitchd unix:/var/run/openvswitch/db.sock \
29 --pidfile=${OVS_VS_PID_FILE} \
30 --detach \
31 --monitor
32 if [ $? -gt 0 ]; then
33 stat_fail
34 else
35 stat_done
38 chgrp ovs /var/run/openvswitch/*
39 chmod g+rw /var/run/openvswitch/*
41 add_daemon openvswitch
43 stop)
44 stat_busy "Stopping Open vSwitch daemon"
45 kill $(< ${OVS_VS_PID_FILE}) &> /dev/null
46 if [ $? -gt 0 ]; then
47 stat_fail
48 else
49 stat_done
51 rm ${OVS_VS_PID_FILE} &> /dev/null
52 stat_busy "Stopping Open vSwitch DB server"
53 kill $(< ${OVS_DB_PID_FILE}) &> /dev/null
54 if [ $? -gt 0 ]; then
55 stat_fail
56 else
57 stat_done
59 rm_daemon openvswitch
61 restart)
62 $0 stop
63 sleep 1
64 $0 start
67 echo "usage: $0 {start|stop|restart}"
68 esac
69 exit 0