#!/bin/bash

app_name1='tnb-gateway'
app_name2='tnb-account'
app_name3='tnb-user'
app_name4='tnb-message'
app_name5='tnb-file'
app_name6='tnb-content'
app_name7='tnb-data'
app_name8='oss-store'
app_name9='bntweb'

for((i=1; i<=9; i++));
do
    app_name=$(eval echo \${app_name$i})
	pid=`ps aux | grep ${app_name} | grep -v 'grep' | tr -s ' '| cut -d ' ' -f 2`
    if [[ -z ${pid} ]];
    then
        echo ${app_name}" killed"
    else
        echo "kill "${app_name}" with pid "${pid}
        kill -15 ${pid}
    fi
done
