diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh index 28d205f03e0f..b7233e6e9bf3 100755 --- a/sbin/spark-daemon.sh +++ b/sbin/spark-daemon.sh @@ -98,6 +98,10 @@ spark_rotate_log () . "${SPARK_HOME}/bin/load-spark-env.sh" if [ "$SPARK_IDENT_STRING" = "" ]; then + # if for some reason the shell doesn't have $USER defined + # (e.g., ssh'd in to execute a command) + # let's get the effective username and use that + USER=${USER:-$(id -nu)} export SPARK_IDENT_STRING="$USER" fi