#!/bin/bash

set -e

JOB_ROOT=/var/vcap/jobs/pravega-controller
CONF_DIR=$JOB_ROOT/config
SYS_ROOT=/var/vcap/sys
LOG_DIR=$SYS_ROOT/log/pravega-controller
RUN_DIR=$SYS_ROOT/run/pravega-controller
PIDFILE=$RUN_DIR/pid
export JAVA_HOME=/var/vcap/packages/jdk8/jdk
export PATH=$JAVA_HOME/bin:$PATH

case $1 in

  start)
    echo $$ > $PIDFILE
    export PRAVEGA_CONTROLLER_OPTS="\"-Dconfig.file=$CONF_DIR/controller.conf\" \"-Dlogback.configurationFile=$CONF_DIR/logback.xml\" \"-Dlog.dir=$LOG_DIR\""

    exec chpst -u vcap:vcap \
      /var/vcap/packages/pravega/bin/pravega-controller \
      >>/var/vcap/sys/log/pravega-controller/stdout.log \
      2>>/var/vcap/sys/log/pravega-controller/stderr.log
    ;;

  stop)
    if [ -f $PIDFILE ]; then
      kill -9 `cat $PIDFILE` || true
      rm -f $PIDFILE
    fi
    ;;

  *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;

esac
exit 0

#!/bin/bash

set -e

JOB_ROOT=/var/vcap/jobs/pravega-controller
CONF_DIR=$JOB_ROOT/config
SYS_ROOT=/var/vcap/sys
LOG_DIR=$SYS_ROOT/log/pravega-controller
RUN_DIR=$SYS_ROOT/run/pravega-controller
PIDFILE=$RUN_DIR/pid
export JAVA_HOME=/var/vcap/packages/jdk8/jdk
export PATH=$JAVA_HOME/bin:$PATH

case $1 in

  start)
    echo $$ > $PIDFILE
    export PRAVEGA_CONTROLLER_OPTS="\"-Dconfig.file=$CONF_DIR/controller.conf\" \"-Dlogback.configurationFile=$CONF_DIR/logback.xml\" \"-Dlog.dir=$LOG_DIR\""

    exec chpst -u vcap:vcap /var/vcap/packages/pravega/bin/pravega-controller \
      >>$LOG_DIR/stdout.log \
      2>>$LOG_DIR/stderr.log
    ;;

  stop)
    if [ -f $PIDFILE ]; then
      kill -9 `cat $PIDFILE` || true
      rm -f $PIDFILE
    fi
    ;;

  *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;

esac
exit 0

Fix incorrect path for pravega-controller
Fix incorrect path for pravega-controller
