Skip to content

Commit

Permalink
judge whether sudo exist (#12)
Browse files Browse the repository at this point in the history
Signed-off-by: xiang <[email protected]>
  • Loading branch information
WangXiangUSTC authored Jan 11, 2022
1 parent 809db82 commit 884b700
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/bminstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ fi
USER=`echo "$USER"`
PID=${*: -1}
PID_USER="$( ps -o uname= -p "${PID}" )"
SUDO_PATH=`which sudo`

if [ "$USER" == "root" ] && [ "$PID_USER" != "root" ] && [ $JAVA_VERSION -le 8 ]; then
if [ "$USER" == "root" ] && [ "$PID_USER" != "root" ] && [ $JAVA_VERSION -le 8 ] && [ "$SUDO_PATH" != "" ]; then
sudo -u $PID_USER JAVA_HOME=$JAVA_HOME BYTEMAN_HOME=$BYTEMAN_HOME $JAVA_HOME/bin/java ${BYTEMAN_JAVA_OPTS} -classpath "$CP" org.jboss.byteman.agent.install.Install $*
else
java ${BYTEMAN_JAVA_OPTS} -classpath "$CP" org.jboss.byteman.agent.install.Install $*
Expand Down

0 comments on commit 884b700

Please sign in to comment.