#!/bin/bash

export PYTHON_HOME=`which python`

SPLUNK_EXE="$SPLUNK_HOME/bin/splunk"

if [ ! -e "$SPLUNK_EXE" ]
then
    echo "$SPLUNK_EXE was not found.  Please check your SPLUNK_HOME path and try again."
    exit 1
fi

if [ ! -x "$SPLUNK_EXE" ]
then
    echo "$SPLUNK_EXE is not set executable.  Please correct this problem and try again."
    exit 1
fi

# Run the actual CLI environment
"$SPLUNK_EXE" cmd python "$SPLUNK_HOME/etc/apps/framework/cli/appdo.py" $@
