更新 'newset.sh'
This commit is contained in:
parent
92a5c35a53
commit
e3dd04a0ba
16
newset.sh
16
newset.sh
@ -78,24 +78,24 @@ cat>>/etc/profile<<EOF
|
|||||||
PS1='\e[1;37m[\e[m\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;35m\H\e[m \e[4m\`pwd\`\e[m\e[1;37m]\e[m\e[1;36m\e[m\n$'
|
PS1='\e[1;37m[\e[m\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;35m\H\e[m \e[4m\`pwd\`\e[m\e[1;37m]\e[m\e[1;36m\e[m\n$'
|
||||||
|
|
||||||
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
|
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
|
||||||
if [ "$USER_IP" = "" ]
|
if [ "\$USER_IP" = "" ]
|
||||||
then
|
then
|
||||||
USER_IP=`hostname`
|
USER_IP=\`hostname\`
|
||||||
fi
|
fi
|
||||||
if [ ! -d /var/log/history ]
|
if [ ! -d /var/log/history ]
|
||||||
then
|
then
|
||||||
mkdir -p /var/log/history
|
mkdir -p /var/log/history
|
||||||
chmod 777 /var/log/history
|
chmod 777 /var/log/history
|
||||||
fi
|
fi
|
||||||
if [ ! -d /var/log/history/${LOGNAME} ]
|
if [ ! -d /var/log/history/\${LOGNAME} ]
|
||||||
then
|
then
|
||||||
mkdir -p /var/log/history/${LOGNAME}
|
mkdir -p /var/log/history/\${LOGNAME}
|
||||||
chmod 300 /var/log/history/${LOGNAME}
|
chmod 300 /var/log/history/\${LOGNAME}
|
||||||
fi
|
fi
|
||||||
export HISTSIZE=4096
|
export HISTSIZE=4096
|
||||||
DT=`date "+%Y-%m-%d_%H:%M:%S"`
|
DT=\`date "+%Y-%m-%d_%H:%M:%S"\`
|
||||||
export HISTFILE="/var/log/history/${LOGNAME}/${USER_IP}-log.$DT"
|
export HISTFILE="/var/log/history/\${LOGNAME}/\${USER_IP}-log.$DT"
|
||||||
chmod 600 /var/log/history/${LOGNAME}/*log* 2>/dev/null
|
chmod 600 /var/log/history/\${LOGNAME}/*log* 2>/dev/null
|
||||||
######################代码结束#######################
|
######################代码结束#######################
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user