source: branches/fc15-dev/locker/sbin/rpm-master.sh @ 1938

Last change on this file since 1938 was 1657, checked in by andersk, 14 years ago
rpm-master.sh: Fix fd redirections to what I actually said the first time
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/sh
2
3echo "Entering correct directory..."
4mkdir -p /mit/scripts/cron_scripts/rpm-sync/
5cd /mit/scripts/cron_scripts/rpm-sync/
6
7echo "Cleaning up environment..."
8rm -rf *.rpmlist *.diff rpmlist.master missing.rpms
9
10servers=`finger @scripts-director.mit.edu | grep "\->" | grep EDU | awk '{print $2}' | cut -d: -f1 | sort | uniq`
11
12for server in $servers; do
13    echo "Connecting to $server..."
14    { 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
15done
16
17echo "Creating master package list..."
18cat *.rpmlist | sort | uniq > rpmlist.master
19
20echo "Comparing scripts servers to overall rpm list..."
21touch missing.rpms
22for server in *.rpmlist; do
23    diff -U3 $server rpmlist.master > $server.diff
24    serverPretty=`basename $server .rpmlist`
25    echo "Server $serverPretty is missing:" >> missing.rpms
26    grep "^+[^+]" $server.diff | cut -b 1 --complement >> missing.rpms
27    echo >> missing.rpms
28done
29
30if [ `egrep -c -v '(missing)|(^$)' missing.rpms` -gt 0 ]; then
31    echo "Sending email..."
32    cat missing.rpms | mail -s "scripts.mit.edu servers are out of sync" root@scripts.mit.edu
33else
34    echo "No email needs to be sent! scripts.mit.edu is up to date."
35fi
Note: See TracBrowser for help on using the repository browser.