#!/bin/sh
#判断进程是否存在，如果不存在就启动它
while true
do
sleep 30
PIDS=`ps|grep kk_midware |grep -v grep | awk '{print $1}'`
if [ "$PIDS" != "" ]; then
	echo "kk_midware is runing!"
else
	/home/kk/kk_midware >/dev/null 2>&1 &
#运行进程
fi
sleep 30
PIDS=`ps|grep kcloud |grep -v grep | awk '{print $1}'`
if [ "$PIDS" != "" ]; then
	echo "kcloud is runing!"
else
	echo "kcloud is not running ,now restart kk_midware and kcloud"
	pgrep kk_midware | xargs kill -s 9
	/home/kk/kk_midware >/dev/null 2>&1 &
	/home/kk/kcloud >/dev/null 2>&1 &
fi
done
