Tags: CPU monitoring shell Linux AutomationRequirements: accurately monitor CPU with top commandPreparation knowledge: Top use, basic awk, DC (default bash shell does not support decimal operations)The script is as follows[[emailprotected] scripts]# cat cpu.sh #!/bin/bash -# top -n 参数指定运行次数,1代表运行一次即停止,不再等待top数据更新,使用awk指定分割符,提取数据cpu_us=`top -n 1 | grep ‘Cpu(s)‘ |
There is a HIVE-E command in hive that can pass parameters, but when the HQL statement is more, the entire shell script will look messy, of course someone might say hive-f can implement a direct call to a file,bingo indeed, but there is a big flaw, This is not a parameter can not be passed in the actual work is intolerable. So I think of the encapsulation of a
1,First, ldd is not an executable program, but a shell script.
2,Ldd can display the dependency of executable modules by setting a series of environment variables, such as LD_TRACE_LOADED_OBJECTS, LD_WARN, LD_BIND_NOW, LD_LIBRARY_VERSION, and LD_VERBOSE. When the LD_TRACE_LOADED_OBJECTS environment variable is not empty, when any executable program is running, it only displays the dependency of the module,
The set command sets the parameter variables for the shell. The output of many commands is a space-delimited value, and using set is very effective if you want to use one of these data fields.
#!/bin/shecho the date is $ (date)Set $ (date)echo the month is $Output:The date is Wed Apr 15:34:16 CST 2014The month is APR
The output of the date command is set to the
As system O M personnel, it is necessary to monitor important system parameters in real time, such as zombie processes, CPU utilization, memory usage, disk space usage, and system load balancing, based on the latest information, we can determine whether the system is running well. I have a little time to contact the Linux system. I checked it online and sorted out some common system monitoring command shell
Crontab can execute a shell script and execute a series of Linux commands at a specified timeExample: Server administrator regularly backs up database data, logs, etc.DetailedCommon commands:Crontab–e //Modify the crontab file, if the file does not exist, it will be created automatically. Crontab–l //display crontab file. Crontab-r //delete crontab file. Crontab-ir //delete crontab file be
Tags: delete file sync Create folder bin error you/tmp should delete a fileThe RM command on a Linux system is too dangerous to accidentally delete system files. Write a shell script to replace the system's RM command, requiring a backup to be made when deleting a file or directory, and then deleting it.Suppose you hav
the current time, (year-month-day), for example:[Email protected] ding1]# date +%f2017-10-05[Email protected] ding1]#+%f is equivalent to +%y-%m-%dFor example:[Email protected] ding1]# date +%y-%m-%d17-10-05[Email protected] ding1]# date +%y*%m*%d #中间的符号自己定义17*10*05[Email protected] ding1]#For example I want to show the next month and the next year today[Email protected]lhost ding1]# date-d +1month +%y-%m-%d17-11-05[Email protected] ding1]# date-d +1year +%f2018-10-05[Email protected] ding1]#Da
1.linux Bash built-in commands differ from common commands: which can't find them. Bash built-in commands2.history is a bash built-in command that can be opened by bash3.set-o See if Open1) in Interactive view[Email protected] ~]# Set-o |grep HistoryHistory on2) View in script[Email protected] ~]# sh a.shHistory offScript content:##! /bin/shHistfile=~/.bash_historySet-o |grep History4.set-o
This problem occurs because of a line-wrapping problemUnder Windows, edit the script with a newline character of "\n\r", but under Linux, the line break is "\ n". After editing in Windows and then running under Linux, the line break only uses "\ n" and the remaining "\ r" is executed as a standalone command, but "\ r" is not a shell
Shell remote execution: It's often necessary to execute some shell commands remotely to other nodes, and if you ssh to each host again, it's a hassle, so you can have a centralized management approach. Describes how the two shell commands are executed remotely. Prerequisites: Configure SSH password-free login for a simple
SHELL script strategy (Study Notes) -- 1.7 expr command full solution, -- 1.7 expr
The expr command can be used to perform numeric operations, numeric or string comparison, string matching, string extraction, and string length calculation. It also has several special functions to determine whether a variable or paramet
Tags: shell script periodic commands use quotation marks Roo chmod log file var logSimple little script, big God DetourImplementation steps:1 Writing scripts2 Doing recurring planning tasks1 scripting[Email protected] ~]# vim tar.shScript content:#!/bin/bash#编写备份脚本, the file name contains a date label after the backup, preventing subsequent backups from overwriti
As system O M personnel, it is necessary to monitor important system parameters in real time, such as zombie processes, CPU utilization, memory usage, disk space usage, and system load balancing, based on the latest information, we can determine whether the system is running well. I have a little time to contact the Linux system. I checked it online and sorted out some common system monitoring command shell
. (It is safest to install the software upgrade through the library)If you need to add some additional repositories to your PMS, you'll need to set up this file.9.3 Red Hat-based systemsThere are also several different front-end tools available, often with the following three types:Yum: Used in red Hat and fedora.URPM: Use in MandrivaZypper: Using in openSUSEThese commands are based on the RPM command-line tool.Because at present only touches the Ubun
1.#-------------------------------------------------------------------------9 # Note that there must be no spaces before and after the assignment.10 # what will happen if there is a space?1112 # If "variable = value ",13 # ^14 # + the script will try to run a "variable" command with a "= value" parameter.1516 # If "variable = value ",17 # ^18 # + script tries to
Use the key file.This assumes that host a (192.168.100.3) is used to obtain a file for Host B (192.168.100.4). Execute the following command on host A to generate the pairing key: ssh-keygen-t RSA encounters a prompt to enter by default, and the public key is stored in the user directory. The SSH directory, such as root, is stored in:/root/.ssh/id_rsa.pub. Id_ in the. SSH directory Rsa.pub file is copied to host B's ~/.ssh/directory and renamed Author
logical relationship between the commands around the symbol.ls Echo " Hdakl "Ls:cannot access das:no such file or directoryHdaklEcho " Hdakl " ls ds Hdakl general use of and | | , it's basically logical and logical, or :command1 Command2 | | Command3. Because in practice, Command2 and Command3 should all be commands that you want to execute. If Command1 is executed correctly, $? equals 0, executes Command2, and then the situation executes Command3, if the Command1 error executes, $? is not
Tags: root count str repeats no duplicate class world direct contentUniqOriginal: http://blog.csdn.net/xifeijian/article/details/9209627The Uniq command removes duplicate rows from a sorted file, so Uniq is often used in combination with sort. That is, in order for the Uniq to work, all duplicate rows must be contiguous.Uniq syntax[[email protected] ~]# uniq [-ICU] options and Parameters: -I: Ignoring the difference between uppercase and lowercase c
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.