source: branches/fc19-dev/locker/sbin/rpm-master.sh @ 2646

Last change on this file since 2646 was 2274, checked in by achernya, 12 years ago
Set locale to C so sort produces consistent results for rpm-sync
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/sh
2
3export LC_ALL=C
4
5echo "Entering correct directory..."
6mkdir -p /mit/scripts/cron_scripts/rpm-sync/
7cd /mit/scripts/cron_scripts/rpm-sync/
8
9echo "Cleaning up environment..."
10rm -rf *.rpmlist *.diff rpmlist.master missing.rpms
11
12servers=`finger @scripts-director.mit.edu | grep "\->" | grep EDU | awk '{print $2}' | cut -d: -f1 | sort | uniq`
13
14for server in $servers; do
15    echo "Connecting to $server..."
16    { ssh $server /mit/scripts/sbin/rpmlist.sh 2>&1 >&3 | grep -Fxv 'If you have trouble logging in, see http://scripts.mit.edu/faq/41/.'; } 3>&1 >&2
17done
18
19echo "Creating master package list..."
20cat *.rpmlist | sort | uniq > rpmlist.master
21
22echo "Comparing scripts servers to overall rpm list..."
23touch missing.rpms
24for server in *.rpmlist; do
25    diff -U3 $server rpmlist.master > $server.diff
26    serverPretty=`basename $server .rpmlist`
27    echo "Server $serverPretty is missing:" >> missing.rpms
28    grep "^+[^+]" $server.diff | cut -b 1 --complement >> missing.rpms
29    echo >> missing.rpms
30done
31
32if [ `egrep -c -v '(missing)|(^$)' missing.rpms` -gt 0 ]; then
33    echo "Sending email..."
34    cat missing.rpms | mail -s "scripts.mit.edu servers are out of sync" root@scripts.mit.edu
35else
36    echo "No email needs to be sent! scripts.mit.edu is up to date."
37fi
Note: See TracBrowser for help on using the repository browser.