Unix fdisk -l Automation

Hello Folks - Need help really ASAP.

Iam trying to run this Shell command to get all the lists of partitions and disks from across all the servers.

#!/bin/ksh
_servers=""
_out="/tmp/output.$$"
_ssh=/usr/bin/ssh

>$_out
for s in $_servers
do
        $_ssh $s fdisk -l >> $_out
done

And in what way does it not work?

Hello -

So when i try to run this shell, this is the output that iam getting.

ksh: line 1: fdisk: not found

Where is fdisk on these servers?

/sbin

also i was trying to do this in all the 262 servers that we have....so that i can get the list of all the disks and partitions and send these details in the output....i dont want to try and manually login to each server and type the command.

So, try /sbin/fdisk.

Yes i know it worked before, but i want to know how i can incorporate that in the Script? so that it doesn't error out when i run the script.

How about

        $_ssh $s /sbin/fdisk -l >> $_out 

Thanks for the code...Sorry took me a while to realize there was a reply