#!/bin/bash

source ./common.sh

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

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

z=${zn[0]}
n=${zn[1]}

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

echo 'success'
