Skip to content

Commit 9570f6b

Browse files
committed
add a script for record the operation history of everyone.
1 parent 1f01582 commit 9570f6b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

bashrc/install-batch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ aptitude -y install git
6969
aptitude -y install gitk
7070
aptitude -y install svn
7171
aptitude -y install mysql-server
72+
aptitude -y install sysklogd
7273
#aptitude -y install arduino
7374
#aptitude -y install eclipse-jdt
7475
#aptitude -y install python-pip

bashrc/userlog.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# usage: install this file to /etc/profile.d/ or add to /etc/profile
2+
export HISTTIMEFORMAT="%y-%m-%d %H:%M:%S "
3+
PS1="`whoami`@`hostname`:"'[$PWD]'
4+
5+
history
6+
USER_IP=`who -u am i 2>/dev/null | awk '{print $NF}' | sed -e 's/[()]//g'`
7+
8+
if [ "X$USER_IP" == "X:0" ]; then
9+
USER_IP=`hostname`
10+
elif [ "X$USER_IP" == "X" ]; then
11+
USER_IP=`hostname`
12+
fi
13+
14+
if [ ! -d "/tmp/history" ]; then
15+
mkdir /tmp/history
16+
chmod 777 /tmp/history
17+
fi
18+
19+
if [ ! -d /tmp/history/${LOGNAME} ]; then
20+
mkdir /tmp/history/${LOGNAME}
21+
chmod 300 /tmp/history/${LOGNAME}
22+
fi
23+
24+
export HISTSIZE=4096
25+
DT=$(date +"%Y%m%d_%H%M%S")
26+
export HISTFILE="/tmp/history/${LOGNAME}/${USER_IP}_history.$DT"
27+
chmod 600 /tmp/history/${LOGNAME}/*history* 2>/dev/null

0 commit comments

Comments
 (0)