#!/bin/bash

set -e
set -u

APPSH_HOME=$(cd $(dirname "$0")/.. && pwd)

. $APPSH_HOME/lib/common
# HEADER END

assert_is_app

method="$1"; shift

bin=`app-conf get app.operator`
bin=${bin:-$APPSH_HOME/libexec/app-operator-pid}

if [ ! -x "$bin" ]
then
  fatal "Invalid executable: $bin" >&2
fi

run_app "$bin" "$method" "$@"