Last change
on this file since 1654 was
1654,
checked in by achernya, 14 years ago
|
Added grep to try and remove the extraneous lines from ssh
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1640] | 1 | #!/bin/sh |
---|
[1639] | 2 | |
---|
| 3 | echo "Entering correct directory..." |
---|
| 4 | mkdir -p /mit/scripts/cron_scripts/rpm-sync/ |
---|
| 5 | cd /mit/scripts/cron_scripts/rpm-sync/ |
---|
| 6 | |
---|
| 7 | echo "Cleaning up environment..." |
---|
| 8 | rm -rf *.rpmlist *.diff rpmlist.master missing.rpms |
---|
| 9 | |
---|
[1641] | 10 | servers=`finger @scripts-director.mit.edu | grep "\->" | grep EDU | awk '{print $2}' | cut -d: -f1 | sort | uniq` |
---|
[1639] | 11 | |
---|
| 12 | for server in $servers; do |
---|
| 13 | echo "Connecting to $server..." |
---|
[1654] | 14 | ssh $server /mit/scripts/sbin/rpmlist.sh 2>&1 | grep -v "scripts.mit.edu" 1>&2 |
---|
[1639] | 15 | done |
---|
| 16 | |
---|
| 17 | echo "Creating master package list..." |
---|
| 18 | cat *.rpmlist | sort | uniq > rpmlist.master |
---|
| 19 | |
---|
| 20 | echo "Comparing scripts servers to overall rpm list..." |
---|
| 21 | touch missing.rpms |
---|
| 22 | for 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 |
---|
| 28 | done |
---|
| 29 | |
---|
[1643] | 30 | if [ `egrep -c -v '(missing)|(^$)' missing.rpms` -gt 0 ]; then |
---|
[1639] | 31 | echo "Sending email..." |
---|
[1640] | 32 | cat missing.rpms | mail -s "scripts.mit.edu servers are out of sync" root@scripts.mit.edu |
---|
[1639] | 33 | else |
---|
| 34 | echo "No email needs to be sent! scripts.mit.edu is up to date." |
---|
| 35 | fi |
---|
Note: See
TracBrowser
for help on using the repository browser.