#!/bin/bash

source ./common.sh

ps -ef|grep ${PROJECT_NAME} > bin/ps.log

instances=(${1//,/ })
n=$2

for i in ${instances[@]}
do
    pm2 delete ecosystem.config.js --only ${PROJECT_NAME}_n${n}_i${i} $n $i ${PROJECT_NAME}
    pm2 start ecosystem.config.js --only ${PROJECT_NAME}_n${n}_i${i} $n $i ${PROJECT_NAME}
done

echo 'success'
