#!/bin/sh

# user check
USER=`whoami`
if [ "${USER}" != "ejobmgr" ];then
  echo "please execute this command as ejobmgr"
  exit 1
fi

# global.cof load
LANG=C;export LANG
SCRIPT_DIR=`dirname $0`
. ${SCRIPT_DIR}/../global.conf

REPOSITORY_JOBWRAPPER=$1
JOBWRAPPER_HOME=${ROOT}/repository/${REPOSITORY}/${JOBWRAPPER}
CONTROLLER=${JOBWRAPPER_HOME}/controller.sh

if [ "${REPOSITORY_JOBWRAPPER}" = "" ];then
 echo "usage is following"
 echo "mkcontroller <REPOSITORY>/<JOBWRAPPER>"
 exit 1
fi

REPOSITORY=`echo "${REPOSITORY_JOBWRAPPER}" | awk -F"/" '{print $1}'`
JOBWRAPPER=`echo "${REPOSITORY_JOBWRAPPER}" | awk -F"/" '{print $2}'`

if [ ! -f ${ROOT}/repository/${REPOSITORY}/${JOBWRAPPER}/jobwrapper.prof ];then
 echo "jobwrapper is not exist"
 exit 1
fi


## jobwrapper prof load
vi ${ROOT}/repository/${REPOSITORY}/${JOBWRAPPER}/jobwrapper.prof 
