#!/bin/bash ID=$1 if [ -z $ID ]; then echo "containerid must't be empty,invalid start arg!!!" exit -1 fi echo -n $ID>/aps/container.txt startFunc() { PROC=`ps aux | grep "$1" | grep -v grep | grep -v tail` if [ -z "${PROC}" ]; then date +%D-%T" $1 start" nohup ./$1 > /dev/null 2>&1 & else echo "$1 is exists" fi } #cd /aps #if etcd process not exist, saas-user-service will stop #nohup ./saas-user-service >/dev/null 2>&1 & #./saas-api-saas while true do startFunc apsClient sleep 2 done