After openvswitch 2.1.2 is installed, it is often possible to start and stop. To avoid repeating the script to start and stop the terminal code, it is best to write it in a different script to facilitate the next call. The premise is that openvswitch has been installed and the database Conf. DB has been created according to the following statements:
mkdir -p /usr/local/etc/openvswitch ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
Start script:
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --pidfile --detachovs-vsctl --no-wait initovs-vswitchd --pidfile --detach
Enable the ovsdb-server and-vswtichd services.
Stop script:
kill `cd /usr/local/var/run/openvswitch && cat ovsdb-server.pid ovs-vswitchd.pid`##cat ovs-brcompatd.pid ovs-controller.pid ovs-monitor-ipsec.pid##
Go to the installation path of openvswitch and kill the ovsdb-server and ovs-vswitchd processes.
Start and Stop the shell script after openvswitch 2.1.2 is installed.