| # Change this accordingly |
| script_name="topology_rest.py" |
| restscript=${WEBDIR}/$script_name |
| LOGDIR=${ONOSDIR}/onos-logs |
| REST_LOG="${LOGDIR}/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 |
| $restscript > $REST_LOG 2>&1 & |
| echo "Usage: $0 {start|stop|status}" |