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

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)