Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Compare 2 files with different keywords : use server health-check tool Post 303038604 by GeekyJimmy on Saturday 7th of September 2019 10:27:45 AM
Old 09-07-2019
Compare 2 files with different keywords : use server health-check tool

I have two files to be compared to get the output of the differences.
File1 has a lot more lists than File2.

After searching a lot on this thread I'am unable to find the exact code that im willing to get.

This will be used as 'pre-check'/post-check utility (health check Tool) to compare some OS processes post server reboot activities.

- I need to know if DISK or DATABASES are not up as compared to File A. The output file will show "WARNING" .
- If the DISK and DATABASE match in both the files, It will simply show "SUCCESS"


My requirement is to differentiate the keywords (like available disks, OS processes) from File1 to File2 and get output in another file if the required keyword doesnt match.


We are able to get the output of various component (database and Disks )in different files.

PRE_Running_Database.log

Code:
DATABASE1
DATABASE5
DATABASE2
DATABASE3
DATABASE4
DATABASE6



POST_Running_Database.log
Code:
DATABASE1
DATABASE3
DATABASE4
DATABASE5



DISK_pre_check.log

Code:
DISK                                   
-------------------------                  
/dev/rprod_0032_011                        
/dev/rprod_0032_013                        
/dev/rprod_0032_015                        
/dev/rprod_0032_016                        
/dev/rprod_0032_017                        
/dev/rprod_0032_018                        
/dev/rprod_0032_019                        
/dev/rprod_0032_020                        
/dev/rprod_0032_021



DISK_post_check.log
-------------------------
Code:
/dev/rprod_0032_011                        
/dev/rprod_0032_012                        
/dev/rprod_0032_013                        
/dev/rprod_0032_014                        
/dev/rprod_0032_015                        
/dev/rprod_0032_016                        
/dev/rprod_0032_017                        
/dev/rprod_0032_018                        
/dev/rprod_0032_019                        
/dev/rprod_0032_020                        
/dev/rprod_0032_021

Output :


Code:
DISK :  SOME MISSING
DATABASE :  SOME NOT RUNNING

 

10 More Discussions You Might Find Interesting

1. HP-UX

check health

Dear Gentelmen I need command for display to me the following statement: -battery state -The application if working or not -The cpu is working or not -The power supply is working or not -The Data base is workig or not (2 Replies)
Discussion started by: magasem
2 Replies

2. AIX

AIX Health Check

Hi All, I would like to know if there is a downloadable AIX health check script available from IBM that would print a report of a servers health status. I've been working on a number of Sun Solaris servers and Sun provide a sun checkup script which can give you an ORI figure as well as a list... (3 Replies)
Discussion started by: backslash
3 Replies

3. Solaris

sun server health check

do anybody has a procedure for daily weekley monthly health check for SUN server with solaris OS?? (5 Replies)
Discussion started by: mm00123
5 Replies

4. Shell Programming and Scripting

Health check script

Hi, I have a server type(A group of AIX,HP-UX and Linux servers running with different appn) in which i need to do health check(memory,cpu,h/w etc). I am planning to automate the same. Please help me out in writing the same. Thanks Renjesh Raju (9 Replies)
Discussion started by: Renjesh
9 Replies

5. Shell Programming and Scripting

Health check script

There are 3 servers . I want to fire commands df -kh and mpstat -P ALL on those individual servers and retrieve particular values to genrate reports. This part is almost done. But i am facing issue when i need to compile the reports from all three servers on to one server in order to generate a... (1 Reply)
Discussion started by: pratikm23
1 Replies

6. HP-UX

HP-UX Health Check

Hi Experts, I want to check health of hp-ux box. Basically I want to check if there are possibilities of network/memory/cpu bottleneck? Are there are any commands available other than glance in hp-ux for the same? (11 Replies)
Discussion started by: sai_2507
11 Replies

7. Shell Programming and Scripting

Daily health check script

Hi I am still learning how to write shell scripts, so I started to write a script like this: #!/bin/sh date echo outputOK () { echo $1 "" } outputOK () { echo $1 "" } for vol in `/usr/bin/grep -E 'hfs|vxfs|nfs|cifs' /etc/fstab | egrep -v '^#' | awk '{ print $3 }'` do if... (7 Replies)
Discussion started by: fretagi
7 Replies

8. Shell Programming and Scripting

Health check report

Hi Team, I am writing a small script in that I want collect all servers of /opt and /stage. Below is my small script #!/bin/ksh #checking Media server opt_Disk_Space_logs myclient=`cat media_server.txt` > opt_logs.txt printf " Server Name\tsize\tused\tavail\tcapacity\tMounted... (12 Replies)
Discussion started by: bashi77
12 Replies

9. AIX

AIX Health Check

Hi everyone, I am new to the Unix admin position, needed some help. My management wants to report how their over all AIX servers / environment is doing so far. I've been researching and found multiple commands to run on each LPAR, well I have few questions and also wanted to share the commands Im... (12 Replies)
Discussion started by: Adnans2k
12 Replies

10. UNIX for Beginners Questions & Answers

Top 5 cpu and Mem consuming process and files and suggestion for health check

I am middle of writing health check scripts, can you pls share commands on how I can get cpu and Mem of top consuming process info at the moment? Also can u suggest ideas on what all I can look for as a part do health check on red hat Linux server? I searched on site before posting, but... (2 Replies)
Discussion started by: Varja
2 Replies
lucompare(1M)						  System Administration Commands					     lucompare(1M)

NAME
lucompare - compare boot environments SYNOPSIS
/usr/sbin/lucompare [-i infile | -t] [-o outfile] BE_name [-X] /usr/sbin/lucompare [ -C file [-o outfile]] [-X] DESCRIPTION
The lucompare command is part of a suite of commands that make up the Live Upgrade feature of the Solaris operating environment. See live_upgrade(5) for a description of the Live Upgrade feature. The lucompare command compares the contents of the current boot environment (BE) with the contents of another BE. With the -C option, lucompare compares file statistics so that you can determine which files have changed on a BE since a specified time, such as the creation time of a BE. A specified BE must be inactive and in the complete state, as reported by the lustatus(1M) command. Also, a BE cannot have a copy job scheduled, which is also reported by lustatus(1M). A specified BE cannot have any partitions mounted with lumount(1M) or mount(1M). For each file system defined for a specified BE, lucompare compares all files with the files with the same pathnames in the current BE. The files present in the active BE, but not in the specified BE, and vice-versa, are reported. You also have the option to specify a list of files to be compared. If you specify the -C option, instead of doing an absolute comparison of the current BE with a target BE, lucompare compares the files in a specified BE with the list of files recorded in a file. When a BE is created, lucreate(1M) creates a file named :<BE_name> in /etc/lu/com- pare. You can use the -C option to compare the files in a specified BE to this snapshot in /etc/lu/compare or you can compare the BE to a file previously created with the -o option. Comparing a BE to its own snapshot in /etc/lu/compare enables you to determine which files have changed on the BE since its creation. By default, the output of lucompare is written to stdout. With the -C option, you must use the -o option to specify an output file. The output for lucompare is a list of files that differ in permissions, owner, group, or sum, along with the reason for difference. The output format is shown below: > active BE < BE_name reason > file_name:owner:group:number_of_links:mode:type: size or major_minor number:checksum < file_name:owner:group:number_of_links:mode:type: size or major_minor number:checksum The above fields are obtained from the stat(2) structure of the file. The type field can be one of the following: SYMLINK symbolic link FIFO FIFO file CHRSPC character special BLKSPC block special DIR directory REGFIL regular file UNKNOW unknown file type lucompare computes checksums only if the file on the specified BE matches its counterpart on the active BE in all of the fields described above. If the checksums differ, lucompare appends the differing checksums to the entries for the compared files. The lucompare command requires root privileges. OPTIONS
The lucompare command has the following options: -C file Compare file statistics of BE with those recorded in file. file can be the snapshot created at BE creation time, /etc/lu/compare/:<BE_name>, or a file previously created with the -o option. You must use the -o option with this option. -i infile Compare files listed in infile. The files to be compared should be an absolute filename. If the entry in the file is a directory, then comparison is recursive with respect to the directory. Mutually exclusive of -t. -o outfile Send output of differences to outfile. You must use this option if you use -C. -t Compare only nonbinary files. This is achieved by performing a file(1) command on each file in the tree walk and only comparing text files. Mutually exclusive of -i. -X Enable XML output. Characteristics of XML are defined in DTD, in /usr/share/lib/xml/dtd/lu_cli.dtd.<num>, where <num> is the version number of the DTD file. OPERANDS
BE_name Name of the BE to which the active BE will be compared. You cannot specify a BE that is involved in another Live Upgrade operation, or specify a BE for which you have mounted partitions (using lumount(1M) or mount(1M)). EXAMPLES
Example 1: Checking Differences Since BE Creation The following command lists the differences in the BE s8u5 between its creation time and the present. # lucompare -C /etc/lu/compare/:s8u5 -o /var/tmp/compare.out s8u5 Note that /etc/lu/compare/:s8u5 is the file created by lucreate upon creation of a BE. The list of differences is sent to /var/tmp/com- pare.out. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/etc/lutab list of BEs on the system /usr/share/lib/xml/dtd/lu_cli.dtd.<num> Live Upgrade DTD (see -X option) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWluu | +-----------------------------+-----------------------------+ SEE ALSO
lu(1M), luactivate(1M), lucancel(1M), lucreate(1M), lucurr(1M), ludelete(1M), ludesc(1M), lufslist(1M), lumake(1M), lumount(1M), lure- name(1M), lustatus(1M), luupgrade(1M), lutab(4), attributes(5), live_upgrade(5) NOTES
The lucompare command makes no attempt to reconcile any differences it detects between BEs. SunOS 5.10 21 Dec 2001 lucompare(1M)
All times are GMT -4. The time now is 08:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy