centos history

fhxyxzw 2018-06-22

#history

USER_IP=`who-uami2>/dev/null|awk'{print$NF}'|sed-e's/[()]//g'`

HISTDIR=/ddhome/history/the_history

if[-z$USER_IP]

then

USER_IP=`hostname`

fi

if[!-d$HISTDIR]

then

mkdir-p$HISTDIR

chmod777$HISTDIR

fi

if[!-d$HISTDIR/${LOGNAME}]

then

mkdir-p$HISTDIR/${LOGNAME}

chmod300$HISTDIR/${LOGNAME}

fi

exportHISTSIZE=10000

DT=`date+%Y%m%d_%H%M%S`

exportHISTFILE="$HISTDIR/${LOGNAME}/${USER_IP}.history.$DT"

exportHISTTIMEFORMAT="[%Y.%m.%d%H:%M:%S][${USER_IP}][`whoami`]"

chmod600$HISTDIR/${LOGNAME}/*the_history*2>/dev/nul

#history

USER_IP=`who-uami2>/dev/null|awk'{print$NF}'|sed-e's/[()]//g'`

HISTDIR=/ddhome/share/.history

if[-z$USER_IP]

then

USER_IP=`hostname`

fi

if[!-d$HISTDIR]

then

mkdir-p$HISTDIR

chmod777$HISTDIR

fi

if[!-d$HISTDIR/${LOGNAME}]

then

mkdir-p$HISTDIR/${LOGNAME}

chmod300$HISTDIR/${LOGNAME}

fi

exportHISTSIZE=4000

DT=`date+%Y%m%d_%H%M%S`

exportHISTFILE="$HISTDIR/${LOGNAME}/${USER_IP}.history.$DT"

exportHISTTIMEFORMAT="[%Y.%m.%d%H:%M:%S]"

chmod600$HISTDIR/${LOGNAME}/*.history*2>/dev/null

相关推荐