blob: 73f29118e06e8547911082d6c36d42cb5bcbf15a [file] [log] [blame]
David K. Bainbridge317e7d72016-05-11 08:31:44 -07001#!/bin/bash
2
3BG=0
4
5while [ $# -gt 0 ]; do
6 case $1 in
7 -bg|-background)
8 BG=1
9 esac
10 shift
11done
12
David K. Bainbridgef4181702016-06-17 14:44:03 -070013IP=$(ping -c 1 {{ controller_ip }} 2>/dev/null | grep PING | awk '{print $3}' | sed -e 's/[\(\)]//g')
14while [ "$IP x" == " x" ]; do
15 echo "Waiting for controller to resolve ({{ controller_ip }}) ... sleeping 5s and will try again ..."
16 sleep 5
17 IP=$(ping -c 1 {{ controller_ip }} 2>/dev/null | grep PING | awk '{print $3}' | sed -e 's/[\(\)]//g')
18done
19
David K. Bainbridge317e7d72016-05-11 08:31:44 -070020if [ $BG -eq 1 ]; then
Jonathan Hart1728fc82017-08-22 12:47:10 -070021 nohup launcher ofagentapp -i {{ switch_id }} -t $IP 2>&1 > connect.log &
David K. Bainbridge317e7d72016-05-11 08:31:44 -070022else
Jonathan Hart1728fc82017-08-22 12:47:10 -070023 launcher ofagentapp -i {{ switch_id }} -t $IP
David K. Bainbridge317e7d72016-05-11 08:31:44 -070024fi