script- real-time monitoring of the operation of the service Lander

script: Real-time monitoring command who operate what was going on.

Analytical:
Script -t 2> -a time.file scriptfile
after executing this command, any subsequent operation will be recorded.
Which is a timing time.file log file, it records the execution of the command for a few seconds; scriptfile is the command execution log files, which record the implementation of a command, the two file names can be customized.

Plus -q, - -quiet parameter can make the script command to run in silent mode, start and exit script commands are not displayed, the user can completely unaware of the recording screen.
script -q -t 2> time.file -a scriptfile

To stop, just press the key combination by pressing Ctrl + D to end the recording, execute the exit command is required.
$ Exit

There have record players, just as recorded video, execute the following command, replacing the previous sequence file, command file after
scriptreplay time.file scriptfile

Add this parameter -d, -divisor number multiple of the playback speed can be adjusted (may be fractional: slow).
scriptreplay -d 10 time.file scriptfile

The ultimate big move:
mkdir -p / var / log / user_record
vi / etc / Profile
at the end of the file append
automatically log in to add record #
script -t -f -q 2> / var / log / user_record / $ USER- $ UID- `date +% Y% m% d% H% m% S`.time -a / var / log / user_record / $ USER- $ UID-`date +% Y% m% d% H% m% S`. His
IF [ "$ SHLVL" =. 1]; the then
Exit
Fi

In this case, real-time monitoring within their own services, if someone login to the server, you do not perform all of the steps companies can also view the lander operations, see the method is:
cd / var / log / user_record
root-0-20200106212542.his root- 0-20200106212921.his
# above two documents that set out the mechanisms for monitoring the generated file
tail -f root-0-20200106212542.his
after # above this execution, all operations will be shown later in this his file records is dynamic, oh.

Guess you like

Origin www.cnblogs.com/jcjone/p/12158641.html