#!/bin/sh
# a daemon, start and monitor servers
# 2013-09-27 09:28 created by niujiuru

. $(dirname $0)/set_env
. $(dirname $0)/modules/funcs/functions.sh
export_env

INTERVAL=60

while true
do
  if ! is_running "${APPNAME}"
  then
    echo "starting ${APPNAME}: ${APPBINS_PATH}/${APPNAME} &"
    rm -rf ${APPRUNS_PATH}/*.lock
    ${APPBINS_PATH}/${APPNAME} &
  fi
  sleep $INTERVAL
done
