| # Change this accordingly |
| ONOS_HOME=${ONOS_HOME:-${HOME}/ONOS} |
| SCRIPT_NAME="topology_rest.py" |
| SCRIPT_DIR=${ONOS_HOME}/sample/ONS2014demo/scripts |
| REST_SCRIPT=${SCRIPT_DIR}/${SCRIPT_NAME} |
| LOGDIR=${ONOS_LOGDIR:-${ONOS_HOME}/onos-logs} |
| REST_LOG="${LOGDIR}/ons2014demo_rest.`hostname`.log" |
| for cpid in $(ps -o pid= --ppid $1) |
| echo "killing: $(ps -p $1 -o cmd=)" |
| kill -9 $1 > /dev/null 2>&1 |
| for i in `seq $(expr $nr_max - 1) -1 1`; do |
| if [ -f ${logfile}.${i} ]; then |
| mv -f ${logfile}.${i} ${logfile}.`expr $i + 1` |
| pids=`ps -edalf | grep ${SCRIPT_NAME} | grep python | grep -v grep | awk '{print $4}'` |
| # echo "Killed existing prosess (pid: $p)" |
| nr_process=`ps -edalf | grep ${SCRIPT_NAME} | grep python | grep -v grep | wc -l` |
| if [ ${nr_process} != 0 ] ; then |
| echo "rest server is running" |
| echo "rest server is not running" |
| # Make log dir for iperf log files |
| $REST_SCRIPT > $REST_LOG 2>&1 & |
| echo "Usage: $0 {start|stop|status}" |