NIFI-1311 Avoid using sudo for nifi.sh commands when run.as is the same as the user invoking the script.

Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
Aldrin Piri 2015-12-18 18:29:31 -05:00 committed by joewitt
parent fdef994ead
commit 4f7a4e83b1
1 changed files with 6 additions and 2 deletions

View File

@ -53,8 +53,8 @@ detectOS() {
os400=true os400=true
;; ;;
Darwin) Darwin)
darwin=true darwin=true
;; ;;
esac esac
# For AIX, set an environment variable # For AIX, set an environment variable
if ${aix}; then if ${aix}; then
@ -154,6 +154,10 @@ run() {
BOOTSTRAP_CONF="${NIFI_HOME}/conf/bootstrap.conf"; BOOTSTRAP_CONF="${NIFI_HOME}/conf/bootstrap.conf";
run_as=$(grep run.as "${BOOTSTRAP_CONF}" | cut -d'=' -f2) run_as=$(grep run.as "${BOOTSTRAP_CONF}" | cut -d'=' -f2)
# If the run as user is the same as that starting the process, ignore this configuration
if [ "$run_as" = "$(whoami)" ]; then
unset run_as
fi
sudo_cmd_prefix="" sudo_cmd_prefix=""
if $cygwin; then if $cygwin; then