7 月 152016
 

 

修改环境变量配置文件,将历史命令条数由默认1000条改为5000条,使用可供查看的时间格式输出历史命令。

#
#!/bin/bash

#vi /etc/profile
#HISTSIZE=5000
#export HISTTIMEFORMAT=’%F %T ‘
#source /etc/profile
#echo “” > .bash_history

yesterday=`date -d ‘-1 day’ +%Y-%m-%d`

history > /tmp/history.tmp

cat /tmp/history.tmp |grep $yesterday > /tmp/sc.tmp

cat /tmp/sc.tmp |grep startup.sh > /tmp/sc.$yesterday

exit 0;

0 2 * * * root /tmp/startcounter.sh