Annotation of doc/techtips/record_shell_commands.txt, revision 1.2
1.2 ! harris41 1: -------------------------------------------------------
! 2: Better Recording of Shell Commands
! 3: contributed by Scott, sharrison@users.sourceforge.net
! 4: -------------------------------------------------------
1.1 harris41 5:
6: GOAL: Keep track of the time of shell command execution
7: and do not lose command history.
8:
1.2 ! harris41 9: RATIONALE: Delivering educational resources to students via
! 10: educational software is serious business.
! 11: I recommend this technical tip as a practical way to
! 12: improve your ability to capture most of the
! 13: shell commands that would be typically executed on
! 14: your LON-CAPA server system. Someday, you may need
! 15: to reconstruct the events and happenings on your Linux
! 16: operating system over a large historical period.
! 17:
! 18: THE SOLUTION:
1.1 harris41 19: The following solution works well for me
20: on many of my servers.
21:
22: 1. cp /etc/profile /etc/profile.orig
23: 2. Edit /etc/profile
24: 3. diff /etc/profile /etc/profile.orig
25: [root@zaphod root]# diff /etc/profile /etc/profile.orig
26: 32,36c32
27: < HISTSIZE=1000000000
28: < HISTFILESIZE=1000000000
29: < HISTDATE=`date`
30: <
31: < echo "Commands below this line occur after $HISTDATE" >> $HOME/.bash_history
32: ---
33: > HISTSIZE=1000
34: 42c38
35: < export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTFILESIZE INPUTRC
36: ---
37: > export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
38:
39: NOTE: /etc/profile is many times called twice, so there are two
40: lines "Commands below this line"... entered into .bash_history.
41:
42: This is the best solution I have found aside from altering
43: the bash source code and recompiling bash.
44:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>