본문 바로가기
Study & Edu/BigData

vi /etc/profile 안의 내용 - 파란줄만 설정하면 의사분산모드에서 전역에 등록하는법

by 댓츠굿 2015. 3. 7.

# /etc/profile


# System wide environment and startup programs, for login setup

# Functions and aliases go in /etc/bashrc


# It's NOT good idea to change this file unless you know what you

# are doing. Much better way is to create custom.sh shell script in

# /etc/profile.d/ to make custom changes to environment. This will

# prevent need for merging in future updates.


pathmunge () {

    case ":${PATH}:" in

        *:"$1":*)

            ;;

        *)

            if [ "$2" = "after" ] ; then

                PATH=$PATH:$1

            else

                PATH=$1:$PATH

            fi

    esac

}


# export JAVA_HOME=/usr/java/jdk1.6.0_35

export JAVA_HOME=/usr/java/jdk1.6.0_35


# export PATH=$PATH:$JAVA_HOME/bin

export PATH=$PATH:$JAVA_HOME/bin


export CLASSPATH=$JAVA_HOME/jre/ext:$JAVA_HOME/lib/tools.jar

export HADOOP_HOME=/home/root/hadoop-1.0.4


pathmunge /home/root/hadoop-1.0.4/bin


if [ -x /usr/bin/id ]; then

    if [ -z "$EUID" ]; then

        # ksh workaround

        EUID=`id -u`

        UID=`id -ru`
    fi
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
    pathmunge /sbin after
fi

HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

for i in /etc/profile.d/*.sh ; do

    if [ -r "$i" ]; then

        if [ "$PS1" ]; then

            . $i

        else

            . $i >/dev/null 2>&1

        fi

    fi

done


unset i

unset pathmunge


반응형