1
2
|
# mkdir /opt/operation_log
# chmod 777 -R /opt/operation_log
|
1
2
3
4
5
|
# vi /etc/profile #末尾追加一下内容
if
[ $UID -
ge
500 ];
then
exec
script -t 2>
/opt/operation_log/
$USER-$UID-`
date
+%F-%T`.
date
-a -q -f
/opt/operation_log/
$USER-$UID-`
date
+%F-%T`.log
fi
# source /etc/profile #刷新生效
|
1
2
3
4
|
# ll /opt/operation_log/
total 8
-rw-rw-r-- 1
test
test
124 Jul 3 07:17
test
-1001-2015-07-03-07:17:36.
date
-rw-rw-r-- 1
test
test
167 Jul 3 07:17
test
-1001-2015-07-03-07:17:36.log
|
1
|
# scriptreplay test-1001-2015-07-03-07:17:36.date test-1001-2015-07-03-07:17:36.log
|