Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The problem of command column truncated when linux uses top redirection to generate text

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Oswbb monitoring is deployed on the database server. When a failure occurs, it is found that there are only brief commands in the command column in the top monitoring. For example, the command of the oracle process of ckpt or LOCAL=NO is displayed as oracle, so it is impossible to tell which process of oracle has gone wrong. In order for it to display the full command, its xtop.sh script file was changed and the-c option was added. Run the xtop script manually, observe the generated files, and meet the requirements. But there was a problem with oswbb's own call, where the command column was truncated and the maximum length of a line was 80 characters.

Checked the script in oswbb and found no intercept command

Suspect is the problem of environment variables, because there is no problem with manual operation, there is a problem with automatic script call, and there are often environment variable problems when scripts use nohup to call xtop,nohup calls. Check the default environment variables of shell on the Internet and find the variable COLUMNS. If you view the current environment variables through set, you can see COLUMNS=189 and set export COLUMNS=189 in the xtop.sh script to solve the problem.

$* include all command line parameters as a single text value $@ include all command line parameters as separate text values $# number of command line arguments $? The exit status code of the recently used front-end process $- the current command option marks $$the process of the current shell ID (PID) $! The recently executed background process PID$0 the absolute pathname of the command name $_ shell from the command line BASH is used to call the full-text name of shell BASH_ARGC the number of arguments in the current subfunction BASH_ARGV contains the name of the array of all specified command line arguments BASH_COMMAND the name of the command currently being executed BASH_ENV if set Each bash script attempts to execute commands used by the first starting file of this variable, BASH_EXECUTION_STRING, in the-c command line option before running. An array BASH_REMATCH containing the line number of each command in the script, BASH_REMATCH, an array containing text elements that match the specified regular expression, BASH_SOURCE, an array containing the name of the source file where the function has been declared in shell, the child generated by the current shell of the array BASH_SUBSHELL Number of shell the version number of the current bash shell instance BASH_VERSINFO contains the variable array of the major version number and minor version number of the current bash shell instance COLUMNS contains the terminal width of the terminal used by the current bash shell instance COMP_CWORD contains the index value of the variable COMP_WORDS of the current cursor position COMP_LINE the current command line comp _ POINT the index COMP_WORDS of the current cursor position relative to the starting position of the current command Variable array of all words on the command line COMPREPLY contains a variable array of possible filled words generated by the shell function DIRSTACK contains a variable array of current contents of the directory stack EUID current user numeric valid user IDFCEDITfc command default editor FIGNORE colon-delimited file name completion list of suffix names to be ignored by FUNCNAME the name of the currently executed shell function GLOBIGNORE is a colon-separated mode list Defines the file name set to be ignored when expanding the file name GROUPS contains a variable array of histchars control history expansion characters for the current user group list There are up to 3 characters HISTCMD the location of the current command in the history HISTCONTROL controls which commands remain in the history list HISTFILE saves the file name of the shell history list (default is .basj _ history) HISTFILESIZE the upper limit of the number of rows saved in the history HISTIGNORE colon-delimited pattern list used to determine which commands are not saved in the history file the maximum number of records saved in the history file HOSTFILE contains The name of the file read by shell when completing the hostname HOSTNAME the name of the current host HOSTTYPE the machine currently running bash shell IGNOREEOFshell must receive the number of consecutive EOF characters before exiting If this value does not exist, the default is the 1INPUTRCreadline initial file name (default is .inputrc) LANGshell's locale category LC_ALL defines a locale variable Override the LANG variable LC_COLLATE setting the comparison table order used to sort string values LC_TYPE determines how to interpret characters in filename expansion and pattern matching LC_MESSAGES decides to interpret the locale variable LINES of the double quotation mark string preceded by the dollar character ($) the currently executed line number LINES defines the number of lines visible on the terminal MACHTYPE system classes defined in the "cpu- Company-system" format How often does MAILCHECKshell check new messages (in seconds) The default is 60) if the working directory OPTERR before OLDPWDshell is set to 1, bash shell will display the error generated by the getopts command OSTYPE defines the operating system that shell is running, PIPESTATUS has a variable array with the list of exit status codes of the front-end process, if POSIXLY_CORRECT is set, bash will have started the PIDPROMPT_COMMAND of the PPIDbash shell parent process in POSIX mode if set Execute this command before the command line main prompt is displayed PS1 primary command line prompt string PS2 secondary command line prompt string PS3select prompt PS4 if you use the bashde-x parameter, the prompt PWD current working directory RANDOM displayed before the command line display returns a random number of 0032767 Its assignment can be used as the default variable of the random number generator seed REPLYread command SECONDS automatic shell startup to the current description; its assignment will recharge counter SHELLOPTS colon split open bash shell options list SHLVL indicates the shell level, each time there is a new bash shell (startup self-increment) TIMEFORMAT specifies how long the shell display time value format TMOUTselect and read command wait without input (in seconds). The default is zero, which represents the real user ID of the current user of the infinite length UID

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 286

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report