Last change
on this file since 2775 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
|
Rev | Line | |
---|
[1640] | 1 | #!/bin/sh |
---|
[1639] | 2 | |
---|
[2274] | 3 | export LC_ALL=C |
---|
| 4 | |
---|
[1639] | 5 | echo "Entering correct directory..." |
---|
| 6 | mkdir -p /mit/scripts/cron_scripts/rpm-sync/ |
---|
| 7 | cd /mit/scripts/cron_scripts/rpm-sync/ |
---|
| 8 | |
---|
| 9 | echo "Cleaning up environment..." |
---|
| 10 | rm -rf *.rpmlist *.diff rpmlist.master missing.rpms |
---|
| 11 | |
---|
[1641] | 12 | servers=`finger @scripts-director.mit.edu | grep "\->" | grep EDU | awk '{print $2}' | cut -d: -f1 | sort | uniq` |
---|
[1639] | 13 | |
---|
| 14 | for server in $servers; do |
---|
| 15 | echo "Connecting to $server..." |
---|
[1657] | 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 |
---|
[1639] | 17 | done |
---|
| 18 | |
---|
| 19 | echo "Creating master package list..." |
---|
| 20 | cat *.rpmlist | sort | uniq > rpmlist.master |
---|
| 21 | |
---|
| 22 | echo "Comparing scripts servers to overall rpm list..." |
---|
| 23 | touch missing.rpms |
---|
| 24 | for 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 |
---|
| 30 | done |
---|
| 31 | |
---|
[1643] | 32 | if [ `egrep -c -v '(missing)|(^$)' missing.rpms` -gt 0 ]; then |
---|
[1639] | 33 | echo "Sending email..." |
---|
[1640] | 34 | cat missing.rpms | mail -s "scripts.mit.edu servers are out of sync" root@scripts.mit.edu |
---|
[1639] | 35 | else |
---|
| 36 | echo "No email needs to be sent! scripts.mit.edu is up to date." |
---|
| 37 | fi |
---|
Note: See
TracBrowser
for help on using the repository browser.