source: gpfs_3.1_ker2.6.20/lpp/mmfs/samples/gatherlogs.samples.sh @ 108

Last change on this file since 108 was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/usr/bin/ksh
2#
3# Sample script to gather, merge and sort mmfs.log files
4# from nodes listed in file /tmp/gpfs.allnodes
5#
6# /tmp/gpfs.allnodes has been created by the user of this script
7# and contains the host names of the nodes that the
8# mmfs.log files are required from.  No blank lines.
9#
10# Output file is called: /tmp/logs.sorted on node script is executes from
11#
12# Assumes proper rsh execution environment (.rhosts files configured)
13#
14# -----------------------------------------------------------------------
15#
16rm /tmp/logs.merged 2>/dev/null      # remove the intermediate file
17#
18for node in $(cat /tmp/gpfs.allnodes)   # loop through all nodes in file
19do
20  echo Gathering mmfs logs on node $node
21#
22# Change the date below for the date of interest for problem determination
23# Ensure date pattern matches date of interest in logs
24#
25  rsh $node "grep -h \"Nov  3\" /var/adm/ras/mmfs.log*" > /tmp/${node}.output
26  if [[ -s /tmp/${node}.output ]] then
27    cat /tmp/${node}.output | \
28    while read line
29      do
30        echo $node $line >> /tmp/logs.merged    # add hostname to beginning of line
31      done
32  fi
33done
34#
35# sort the merged logs by the date field
36#
37if [[ -s /tmp/logs.merged ]] then
38  sort -k 4,5 /tmp/logs.merged > /tmp/logs.sorted
39  echo sort return code $?
40fi
41#
42exit 
Note: See TracBrowser for help on using the repository browser.