Do not use on any
shared computer
July 24, 2008 01:50pm pdt
 
[x]
Attachment Details

Need Assistance with Linux script on CentOS or Redhat

Hello:

I am fairly Junior Admin.

We have a handful of CentOS Systems on our network and I would like to create a script (shell or perl) that will ssh to the other systems and grab the list of possible updates, but not actually update them. I just want to create a report that list the updates on each host.

So instead of doing sudu yum update on each box, I kick off a script that will do it on all and create a report that looks like:

host1 has the following updates available:
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
kernel x86_64 2.6.18-53.1.14.el5 updates 15 M
kernel-devel x86_64 2.6.18-53.1.14.el5 updates 4.9 M
Updating:
asciidoc noarch 8.2.6-1.el5.rf rpmforge 892


host2 has the following updates available:
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:

nagios-plugins x86_64 1.4.11-1.el5.rf rpmforge 1.3 M
net-snmp-libs x86_64 1:5.3.1-19.el5_1.4 updates 1.2 M

etc, etc...

So far, this is what I have:

#!/bin/bash
##
CNT=1
until [ $CNT -eq 10 ]
do IP=192.168.1.$CNT
REMHOST=`ssh root@$IP -C hostname`
echo "Host $REMHOST at IP $IP returned the following result:"
ssh root@$IP -C yum update | tee list_of_updates
CNT=`expr $CNT + 1`
done

Here are parts I don't know how to do:

1) get the script to automatically respond with "N" after yum update is run on each system and continue to the next host.

2) strip the data I don't want after each scan. There is gobs of data from running yum update, but I only want the data after:
=============================================================================
Package Arch Version Repository Size
=============================================================================

3) get the "Host $REMHOST at IP $IP returned the following result:" to append to the list_of_updates  report after each host is finished.

Your help is really appreciated.
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: Ryman1
Solution Provided By: NVRAM
Participating Experts: 2
Solution Grade: A
Views: 4
Translate:
Loading Advertisement...
 
[+][-]Assisted Solution by Tintin

Rank: Guru

Assisted Solution by Tintin:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Ryman1
Author Comment by Ryman1:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by NVRAM
Accepted Solution by NVRAM:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Ryman1
Author Comment by Ryman1:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Ryman1
Author Comment by Ryman1:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by NVRAM
Expert Comment by NVRAM:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Ryman1
Author Comment by Ryman1:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by Tintin

Rank: Guru

Assisted Solution by Tintin:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Ryman1
Author Comment by Ryman1:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by NVRAM
Expert Comment by NVRAM:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by NVRAM
Expert Comment by NVRAM:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628