tailieunhanh - Mastering unix shell scripting phần 4

Thử nghiệm cho 0-1 chỉ in BINARY_OR_POSITIVE_INTEGER '; + ([0-7])) # Thử nghiệm cho 0-7 chỉ in OCTAL_OR_POSITIVE_INTEGER '+ ([0-9])) # Kiểm tra' iNTEGER in số nguyên; + (-0-9])) # Kiểm tra 'NEGATIVE_WHOLE_NUMBER toàn bộ số lượng in là một tiêu cực; | 188 Chapter 7 OS uname case OS in AIX HP-UX SWITCH -t F1 3 F2 4 F3 5 F4 6 echo nThe Operating System is OS n Linux SunOS SWITCH -c F1 1 F2 2 F3 3 F4 4 echo nThe Operating System is OS n echo nERROR OS is not a supported operating system n echo n . n exit 1 esac Listing Case statement for the iostat fields of data. Notice in Listing that we use a single case statement to set up the environment for the shell script to run the correct iostat command for each of the four Unix flavors. If the Unix flavor is not in the list then the user receives an error message before the script exits with a return code of 1 one. Later we will cover the entire shell script. Syntax for sar The sar command stands for system activity report. Using the sar command we can take direct sample intervals for a specific time period. For example we can take 4 samples that are 10 seconds each and the sar command automatically averages the results for us. Let s look at the output of the sar command for each of our Unix flavors AIX HP-UX Linux and Solaris. AIX sar 10 4 AIX yogi 1 5 000125604800 07 26 02 17 44 54 usr sys wio idle 17 45 04 25 75 0 0 Monitoring System Load 189 17 45 14 25 75 0 0 17 45 24 26 74 0 0 17 45 34 25 75 0 0 Average 25 75 0 0 Now let s look at the average of the samples directly. sar 10 4 grep Average Average 26 74 0 0 HP-UX sar 10 4 HP-UX dino A 9000 715 07 29 102 22 48 10 usr sys wio idle 22 48 20 40 60 0 0 22 48 30 40 60 0 0 22 48 40 12 19 0 68 22 48 50 0 0 0 100 Average 23 35 0 42 Now let s only look at the average of the samples directly. sar 10 4 grep Average Average 25 37 0 38 Linux sar 10 4 Linux bambam 07 29 2002 10 01 59 PM CPU user nice system idle 10 02 09 PM all 10 02 19 PM all 10 02 29 PM all 10 02 39 PM all Average all Now let s look at the average of the samples directly. sar 10 4 grep Average Average all

TỪ KHÓA LIÊN QUAN