Permalink
Browse files

add a script for record the operation history of everyone.

  • Loading branch information...
1 parent 1f01582 commit 9570f6b7104bc94ecaf3df351d2922a0ea459486 @soarpenguin committed Nov 25, 2013
Showing with 28 additions and 0 deletions.
  1. +1 −0 bashrc/install-batch.sh
  2. +27 −0 bashrc/userlog.sh
View
@@ -69,6 +69,7 @@ aptitude -y install git
aptitude -y install gitk
aptitude -y install svn
aptitude -y install mysql-server
+aptitude -y install sysklogd
#aptitude -y install arduino
#aptitude -y install eclipse-jdt
#aptitude -y install python-pip
View
@@ -0,0 +1,27 @@
+# usage: install this file to /etc/profile.d/ or add to /etc/profile
+export HISTTIMEFORMAT="%y-%m-%d %H:%M:%S "
+PS1="`whoami`@`hostname`:"'[$PWD]'
+
+history
+USER_IP=`who -u am i 2>/dev/null | awk '{print $NF}' | sed -e 's/[()]//g'`
+
+if [ "X$USER_IP" == "X:0" ]; then
+ USER_IP=`hostname`
+elif [ "X$USER_IP" == "X" ]; then
+ USER_IP=`hostname`
+fi
+
+if [ ! -d "/tmp/history" ]; then
+ mkdir /tmp/history
+ chmod 777 /tmp/history
+fi
+
+if [ ! -d /tmp/history/${LOGNAME} ]; then
+ mkdir /tmp/history/${LOGNAME}
+ chmod 300 /tmp/history/${LOGNAME}
+fi
+
+export HISTSIZE=4096
+DT=$(date +"%Y%m%d_%H%M%S")
+export HISTFILE="/tmp/history/${LOGNAME}/${USER_IP}_history.$DT"
+chmod 600 /tmp/history/${LOGNAME}/*history* 2>/dev/null

0 comments on commit 9570f6b

Please sign in to comment.