Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5281792
  • 博文数量: 1144
  • 博客积分: 11974
  • 博客等级: 上将
  • 技术积分: 12312
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-13 20:06
文章存档

2017年(2)

2016年(14)

2015年(10)

2014年(28)

2013年(23)

2012年(29)

2011年(53)

2010年(86)

2009年(83)

2008年(43)

2007年(153)

2006年(575)

2005年(45)

分类: LINUX

2006-07-31 20:15:29

vi /etc/profile

添加如下内容:
# history
USER_IP=`who am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`

if [ "$USER_IP" = "" ]
then
  USER_IP=`hostname`
fi

if [ ! -d /tmp/.hist ]
then
   mkdir /tmp/.hist
   chmod 777 /tmp/.hist
fi

if [ ! -d /tmp/.hist/${LOGNAME} ]
then
    mkdir /tmp/.hist/${LOGNAME}
    chmod 300 /tmp/.hist/${LOGNAME}
fi
HISTSIZE=4096
export HISTSIZE
DT=`date "+%Y%m%d_%H%M%S"`
export DT
HISTFILE="/tmp/.hist/${LOGNAME}/${USER_IP}.hist.$DT"
export HISTFILE
chmod 600 /tmp/.hist/${LOGNAME}/*.hist* 2>/dev/null
umask 022
阅读(4035) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~