Solved

Script to obtain hardware and OS information

Posted on 2003-12-03
7
288 Views
Last Modified: 2013-12-27
I’ve just been tasked to obtain the version of Solaris and the type of Sun workstation the user is using.  I know the uname –a command can give me the info I need.  What I don’t want to do is have to telnet to over 400 machines.  Is there a way, I can write a script which rsh’s to each machine by it’s IP address (5.212.144.xxx, 5.212.145.xxx) and write the output of each machine’s uname –a to a text file?  

Thanks,

Brian
0
Comment
Question by:bpb25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 63 total points
ID: 9868916
You will have to set up the .rhosts file on each machine to do that ( or .ssh/authorized_keys if you use ssh).  So if you haven't already  done that, logging into each machine and running the uname command will be as quick.  If however you want to do it , so you can do it again later.
After you have set up your .rhosts file

x==0
while ( $x < 255)
do
rsh uname -a 5.212.144.$x >> /tmp/vers.txt
x=expr ($x + 1)
done

I'm not in front of a unix box at the moment, so my syntax may be a bit dodgy, try it and post the errors
0
 

Author Comment

by:bpb25
ID: 9868988
Ran the script, here's the error I got.

syntax error at line 7: 'x=expr' unexpected

Luckily the majority of the machines already have a .rhosts in place.

0
 
LVL 18

Expert Comment

by:liddler
ID: 9869182
x=`expr ($x+1)`
back single quotes, for a command substitution
0
 
LVL 7

Assisted Solution

by:glassd
glassd earned 62 total points
ID: 9869902
To make the math a bit easier, use Korn shell. Also the rsh line looks a bit odd. And only one subnet was tried. Try:

#!/bin/ksh
x==0
while ( $x < 255)
do
rsh 5.212.144.$x iuname -a >> /tmp/vers.txt
rsh 5.212.145.$x iuname -a >> /tmp/vers.txt
((x = x + 1))
done


0
 

Expert Comment

by:sagar24
ID: 9911451
Hi
You must have remote authentication database set
So create a file /.rhosts(assuming you  will remotely login as root)
enter your system name
create a script  and execute the script
#/bin/sh

x=1
for i in 144 145
do
while($x < 255)
do
rsh 5.212.$i.$x uname -a >> /tmp/info.txt
x=`expr $x + 1`
done
done

regards
sagar
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
removing nim resources 5 70
how to check for shares on aix 1 101
Expand a partition in Centos 7 Linux with Virtualmin 1 78
awk sed variable in file 3 98
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question