Linux script command record (database) operation steps

Source: Internet
Author: User

For DBAs, you often encounter database upgrades or apply patches, and sometimes need to run a large number of scripts. For these operations, we want to output files simultaneously on the screen for subsequent steps or errors that have been lost during query. Script Commands in Linux are a good helper to solve this problem.

1. script command description

The script command will record all operations to the file and output them on the screen at the same time until the login session is terminated, or use CRTL + D, or exit with exit to stop the record.
This command can be used for database upgrades or important settings for subsequent query operations to succeed or fail.
Usage: $ script [upgrade. log]
If no log file name is specified, the log file name is automatically generated as typescript.
If you need to output to an existing Log File, use the-a parameter, and then connect the existing log file name.
If you want to view the content of a log file while outputting it to a log file, you can use the-f parameter.

# Script help description
Robin @ SZDB: ~> Man script
NAME
Script-make typescript of terminal session

SYNOPSIS
Script [-a] [-c COMMAND] [-f] [-q] [-t] [file]

DESCRIPTION
Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record
An interactive session as proof of an assignment, as the typescript file can be printed out later with lpr (1 ).

If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in
File typescript.

Options:

-A Append the output to file or typescript, retaining the prior contents.

-C COMMAND
Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a pro-
Gram that behaves differently when its stdout is not a tty.

-F Flush output after each write. This is nice for telecooperation: One person does 'mkfifo foo; script-f foo' and
Another can supervise real-time what is being done using 'cat foo '.

-Q Be quiet.

-T Output timeing data to standard error. This data contains two fields, separated by a space. The first field indi-
Cates how much time elapsed since the previous output. The second field indicates how many characters were output
This time. This information can be used to replay typescripts with realistic typing and output delays.

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.