.zsh_history.txt中的时间戳转时间
date "+%Y-%m-%d %H:%M:%S" -d @1443864967
/etc/profile中添加:
TMOUT=600 #用户登录后长时间不操作自动断开
#记录用户登录后操作记录
PS1="`whoami`@`hostname`:"'[$PWD]'
history
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
if [ ! -d /tmp/dbasky/`hostname` ]
then
mkdir /tmp/dbasky/`hostname`
chmod 777 /tmp/dbasky/`hostname`
fi
if [ ! -d /tmp/dbasky/`hostname`/${LOGNAME} ]
then
mkdir /tmp/dbasky/`hostname`/${LOGNAME}
chmod 300 /tmp/dbasky/`hostname`/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date "+%Y-%m-%d_%H:%M:%S"`
export HISTFILE="/tmp/dbasky/`hostname`/${LOGNAME}/${USER_IP} dbasky.$DT"
chmod 600 /tmp/dbasky/`hostname`/${LOGNAME}/* 2>/dev/null
mkdir -p /tmp/dbasky
source /etc/profile