Project

General

Profile

Idea #11330

Sandbox -- not a real issue, just play with redmine

Added by Chih-Hao Huang almost 4 years ago. Updated almost 4 years ago.

Status:
New
Priority:
Normal
Start date:
12/30/2015
Due date:
12/29/2025
% Done:

0%

Estimated time:
Experiment:
CMS
Stakeholders:
Duration: 3653

Description

This is not a real issue.
Just a place to play with redmine, especially the formating.

History

#1 Updated by Chih-Hao Huang almost 4 years ago

#!/bin/bash
#
# compare2.sh <node1> <node2> [<file>]
#
# compare:
# [1] rpm
# [2] chkconfig
# [3] dcache services
# [4] important processes
# [5] files in /etc/dcache
#
# with additional <file>, compare <node1>:<file> and <node2>:<file>

# set -xv

node1=$1
shift
node2=$1
shift

# command to generate source to compare
rpm_cmd="rpm -qa | sort" 
chkconfig_cmd="chkconfig --list" 
dcache_cmd="dcache status | grep -v USER | awk -v OFS='\t' '{print \$1,\$2,\$4}' | sort" 
ps_cmd="ps exao uid,cmd | egrep 'dcache|encp|postgres|postmaster|java' | grep -v grep | sort" 
etc_cmd="ls -1Rs /etc/dcache | grep -v .bak | grep -v '~'" 

echo "==== comparing rpms on $node1 and $node2:" 
echo "diff <(ssh -l root $node1 '$rpm_cmd') <(ssh -l root $node2 '$rpm_cmd')" 
diff <(ssh -l root $node1 "$rpm_cmd") <(ssh -l root $node2 "$rpm_cmd")

echo
echo "==== comparing chkconfig on $node1 and $node2:" 
echo "diff <(ssh -l root $node1 '$chkconfig_cmd') <(ssh -l root $node2 '$chkconfig_cmd')" 
diff <(ssh -l root $node1 "$chkconfig_cmd") <(ssh -l root $node2 "$chkconfig_cmd")

# dcache status always show pids, which are, of course different on different nodes
# need to get rid of pids
echo
echo "==== comparing dcache on $node1 and $node2:" 
echo "diff <(ssh -l root $node1 '$dcache_cmd') <(ssh -l root $node2 '$dcache_cmd')" 
diff <(ssh -l root $node1 "$dcache_cmd") <(ssh -l root $node2 "$dcache_cmd")

echo
echo "==== comparing processes on $node1 and $node2:" 
echo "diff <(ssh -l root $node1 '$ps_cmd') <(ssh -l root $node2 '$ps_cmd')" 
diff <(ssh -l root $node1 "$ps_cmd") <(ssh -l root $node2 "$ps_cmd")

echo
echo "==== comparing /etc/dcache on $node1 and $node2:" 
echo "diff <(ssh -l root $node1 '$etc_cmd') <(ssh -l root $node2 '$etc_cmd')" 
diff <(ssh -l root $node1 "$etc_cmd") <(ssh -l root $node2 "$etc_cmd")

# need to ignore sensitive files and insignificant files
echo
echo "==== cmoparing files in /etc/dcache on $node1 and $node2:" 
for i in `ssh -l root $node1 "find /etc/dcache -type f -print | grep -v key | grep -v .bak | grep -v '~'"`
do
    echo
    echo "==== comparing $i ..." 
    echo "diff <(ssh -l root $node1 'cat $i') <(ssh -l root $node2 'cat $i')" 
    diff <(ssh -l root $node1 "cat $i") <(ssh -l root $node2 "cat $i")
done

# check if postgreql is running
pg_data=`ssh -l root $node1 "ps aux | grep postmaster | grep -v grep | awk '{print \\\$NF}'"`
if [ "$pg_data" != "" ] 
then
    echo
    echo "==== postgresql is running" 
echo "==== cmoparing config files in $pg_data on $node1 and $node2:" 
for i in `ssh -l root $node1 "find $pg_data -type f -name '*.conf' -print | grep -v .bak | grep -v '~'"`
do
    echo
    echo "==== comparing $i ..." 
    echo "diff <(ssh -l root $node1 'cat $i') <(ssh -l root $node2 'cat $i')" 
    diff <(ssh -l root $node1 "cat $i") <(ssh -l root $node2 "cat $i")
done
fi

if [ $# -gt 0 ]
then
    echo
    echo "==== comparing files on $node1 and $node2" 
    for i in $*
    do
        echo
        echo "==== comparing $i ..." 
        echo "diff <(ssh -l root $node1 'cat $i') <(ssh -l root $node2 'cat $i')" 
        diff <(ssh -l root $node1 "cat $i") <(ssh -l root $node2 "cat $i")
    done
fi

#2 Updated by Chih-Hao Huang almost 4 years ago

==== comparing rpms on cmsdcacheadmin and cmssrv266:
diff <(ssh -l root cmsdcacheadmin 'rpm -qa | sort') <(ssh -l root cmssrv266 'rpm -qa | sort')
44d43
< compat-libevent14-1.4.13-1.rhel6.x86_64
130d128
< ganglia-gmond-python-3.1.7-6.el6.x86_64
210d207
< jdk-1.7.0_25-fcs.x86_64
214,215d210
< kernel-2.6.32-504.23.4.el6.x86_64
< kernel-2.6.32-504.30.3.el6.x86_64

250c245
< libevent-2.0.19-1.rhel6.x86_64
---
> libevent-1.4.13-4.el6.x86_64

363d357
< mysql-5.1.73-5.el6_6.x86_64
365d358
< mysql-server-5.1.73-5.el6_6.x86_64
373a367
> netxen-firmware-4.0.534-3.1.el6.noarch
429,430d422
< perl-DBD-MySQL-4.013-3.el6.x86_64
< perl-DBI-1.609-4.el6.x86_64
471d462
< postgresql-8.4.20-4.el6_7.x86_64
475,476d465
< postgresql-libs-8.4.20-4.el6_7.x86_64
< postgresql-server-8.4.20-4.el6_7.x86_64
511a501
> rdma-6.7_3.15-5.el6.noarch
628a619
> yum-conf-slf6x-1-3.slf6.noarch
  1. different libevent version
  2. the rest look fine
==== comparing chkconfig on cmsdcacheadmin and cmssrv266:
diff <(ssh -l root cmsdcacheadmin 'chkconfig --list') <(ssh -l root cmssrv266 'chkconfig --list')
19d18
< jexec              0:on    1:on    2:on    3:on    4:on    5:on    6:on
25d23
< mysqld             0:off    1:off    2:on    3:on    4:on    5:on    6:off
29a28
> nfs-rdma           0:off    1:off    2:off    3:off    4:off    5:off    6:off
32c31
< ntpdate            0:off    1:off    2:on    3:on    4:on    5:on    6:off
---
> ntpdate            0:off    1:off    2:off    3:off    4:off    5:off    6:off
36d34
< postgresql         0:off    1:off    2:off    3:off    4:off    5:off    6:off
41a40
> rdma               0:off    1:off    2:off    3:off    4:off    5:off    6:off
76d74
<     terad:             on


Also available in: Atom PDF