Need Remote server Reboot timings

Hi
I need to know the reboot timings of remote servers (all unix/AIX server )with the help of shell script as the list of servers is 400+.

None of the commands uses system name as parameter .What to do ?
I am trying man -b in variety of codes am preparing but all in vain .

#!/bin/ksh
file="/export/home/ABCDE/readIP.txt" 
while read Line
do
#last reboot | head -1 >reboot data.txt 
echo "line " ":" who -b >rebootData.txt
done < $file

Its not working at all for me

hi,

Add the below code in your script

#!/bin/ksh
file="/export/home/ABCDE/readIP.txt" 
while read Line
do
ssh $line << EOF >output.sri
echo $line  ":" who -b
EOF
done < $file
exit 0

you can find the output in output.sri file

Reason: ssh to every server and exicute the required command and redirect o/p to local machine

ssh needs login credentails ?Is it so ? the above script didnt worked even :frowning:

---------- Post updated at 10:41 AM ---------- Previous update was at 10:40 AM ----------

would be thankful if some different piece of code will be provided

with out login credentials also you can do ssh ( I am using that right now). we can change the settings in one ssh file for this i didnt remember that exact file name. you can take the help from your admin. In the mean time i will try for other method.

I am saying it because who -b wont take any system name as parameter so seems hard to find reboot time using who -b

I recommend using the same method suggested by srinivas. But before that you have to setup SSH password-less login to each hosts.

Here is a KSH script:

#!/bin/ksh

while read ip
do
        echo "${ip}\t\c"
        ssh -n ${ip} "who -b | sed -e 's/^[ \t]*\.[ \t]*//'"
done < IP.txt

Here is the output:-

# ./rb.ksh
135.200.101.79  system boot  Jun 21 01:20
135.31.144.154  system boot  Aug 22 00:51
135.214.229.153 system boot  May 23 01:33