01-07-2008
trying to write a script to loop through a port info file
Below is part of a script i have written to loop through part of a port info file. How do i continue the script to get info for OS Device Name, manufacturer and then put information into an array?
HBA Port WWN: 10000000c9420b4b
OS Device Name: /dev/cfg/c10
Manufacturer: Emulex
Model: LP10000DC-S
Firmware Version: 1.92a1
FCode/BIOS Version: none
Type: N-port
State: online
Supported Speeds: 1Gb 2Gb
Current Speed: 2Gb
Node WWN: 20000000c9420b4b
#!/bin/ksh
PORT_INFOFILE=/tmp/aa
if [ -f $PORT_INFOFILE ]; then
rm -f $PORT_INFOFILE
touch $PORT_INFOFILE
fi
# read port info
fcinfo hba-port >> $PORT_INFOFILE 2>&1
cat $PORT_INFOFILE | while read line; do
x=`echo $line | grep "HBA Port"`
if [ -n $x ]; then
NEW_PORT="TRUE"
else
NEW_PORT="FALSE"
fi
9 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
is there a command so that i can se info about the parallel port, if there isn't a specific command for that is there a command so i can se info about the system and all ports and devices?
Thanx
/Nick (2 Replies)
Discussion started by: sajjan2
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
is there a way to get information of an annex device connected to port A ? i need to get the I.P address of the annex and the port
it connected to on the annex.
dori (1 Reply)
Discussion started by: dorilevy
1 Replies
3. Shell Programming and Scripting
Hi,
I am new to ksh scripting so your help will be much appreciated.
I have a file called file.txt which looks like this
Header 20050702 20050703
ABC
DEF
Header 20050703 20050704
123
456
Header 20050704 20050705
XXX
YYY
What I am trying to do is write out each of the record... (7 Replies)
Discussion started by: Jtrinh
7 Replies
4. Programming
Dear Sir,
i m going to use NP5610-16 moxa device for multiport serial communication.
i m using fedora-core 6 o.s.
after installation it will detect serial ports as /dev/ttyr0,/dev/ttyr1...ttyr32.
there are total 32 com ports.
now i want to write application which monitor all serial ports and... (6 Replies)
Discussion started by: amitpansuria
6 Replies
5. Shell Programming and Scripting
below is an extract from my file and I am trying to use Awk and grep and a while loop to pull infomation from under neath "HBA WWN=".HBA WWN=" reoccurs all over the file but the 100000c.....number are unique and I want to be able to pull and reference specifi information under this header ever time... (2 Replies)
Discussion started by: kieranfoley
2 Replies
6. Shell Programming and Scripting
NEWBIE ALERT!
Hi,
I'm 1 month into learning Perl and done reading "Minimal Perl" by Tim Maher (which I enjoyed enoumously). I'm not a programmer by profession but want to use Perl to automate various tasks at my job. I have a problem (obviously) and are looking for your much appreciated help.... (0 Replies)
Discussion started by: jospan
0 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
Following is the program that i have written in cygwin. The redirection of the unfound $param1 to error.txt file doesnt work.Can any one help?
#!/usr/bin/sh
fname=$1
sed 's/ //g' "$fname" > fname1
while read i
do
echo $i > file1
#param1 is script name
... (1 Reply)
Discussion started by: janardhanamk
1 Replies
8. Shell Programming and Scripting
I have a record.txt it will update weekly, and it could be 2 lines or more ...
it just echo each line to the script
san jose,23.34%
tampa,2.15%
dallas,30.20%
seattle,44.29%
Unknown,16.72%
How do i write a shell script to give me a test.pl or bash file which contain
#!/home/perl... (8 Replies)
Discussion started by: sabercats
8 Replies
9. UNIX for Beginners Questions & Answers
I have if loop with multiple variable value check in if loop. How can i print only if loop satisfied variable and its value in shell script ? I dont want to check each variable in if loop. That makes my script larger.
if ]
then
echo "Only satisfied variable with value"
... (3 Replies)
Discussion started by: prince1987
3 Replies
LEARN ABOUT SUNOS
hba_getdiscoveredportattributes
HBA_GetAdapterPortAttributes(3HBAAPI) Common Fibre Channel HBA Information Library Functions HBA_GetAdapterPortAttributes(3HBAAPI)
NAME
HBA_GetAdapterPortAttributes, HBA_GetDiscoveredPortAttributes, HBA_GetPortAttributesByWWN - retrieve Fibre Channel port attributes for a
specific device
SYNOPSIS
cc [ flag... ] file... -lHBAAPI [ library... ]
#include <hbaapi.h>
HBA_STATUS HBA_GetAdapterPortAttributes(HBA_HANDLE handle, HBA_UINT32 portindex, HBA_PORTATTRIBUTES *portattributes);
HBA_STATUS HBA_GetDiscoveredPortAttributes(HBA_HANDLE handle, HBA_UINT32 portindex, HBA_UINT32 discoveredportindex, HBA_PORTATTRIBUTES
*portattributes);
HBA_STATUS HBA_GetPortAttributesByWWN(HBA_HANDLE handle, HBA_WWN PortWWN, HBA_PORTATTRIBUTES *portattributes);
PARAMETERS
handle an open handle returned from HBA_OpenAdapter(3HBAAPI)
portindex the index of a specific port on the HBA as returned by a call to HBA_GetAdapterAttributes(3HBAAPI).
The maximum value specified should be (HBA_ADAPTERATTRIBUTES.NumberOfPorts - 1).
portattributes a pointer to an HBA_PORTATTRIBUTES structure. Upon successful completion, this structure contains the specified port
attributes.
discoveredportinthe index of a specific discovered port on the HBA as returned by HBA_GetAdapterPortAttributes(3HBAAPI). The maximum value
specified should be (HBA_PORTATTRIBUTES.NumberOfDiscoveredPorts - 1).
PortWWN the port WWN of the device for which port attributes are retrieved.
DESCRIPTION
The HBA_GetAdapterPortAttributes() function retrieves Port Attributes for a specific port on the HBA.
The HBA_GetDiscoveredPortAttributes() function retrieves Port Attributes for a specific discovered device connected to the HBA.
The HBA_GetPortAttributesByWWN() function retrieves Port Attributes for a specific device based on the PortWWN argument.
RETURN VALUES
Upon successful completion, HBA_STATUS_OK is returned. Otherwise, an error value is returned from the underlying VSL and the values in
hbaattributes are undefined.
ERRORS
See libhbaapi(3LIB) for general error status values.
EXAMPLES
Example 1: Retrieve the port attributes for each port on the HBA.
The following example retrieves the port attributes for each port on the HBA.
for (hbaPort = 0; hbaPort < hbaAttrs.NumberOfPorts; hbaPort++) {
if ((status = HBA_GetAdapterPortAttributes(handle,
hbaPort, &hbaPortAttrs)) != HBA_STATUS_OK) {
fprintf(stderr, "Unable to get adapter port %d "
"attributes for HBA %d with name "%s".
",
hbaPort, hbaCount, adaptername);
HBA_CloseAdapter(handle);
continue;
}
memcpy(&wwn, hbaPortAttrs.PortWWN.wwn, sizeof (wwn));
printf(" Port %d: WWN=%016llx
", hbaPort, wwn);
/* ... */
}
Example 2: Retrieve the discovered port target attributes for each discovered target port on the HBA.
The following example retrieves the discovered port target attributes for each discovered target port on the HBA.
for (discPort = 0;
discPort < hbaPortAttrs.NumberofDiscoveredPorts;
discPort++) {
if ((status = HBA_GetDiscoveredPortAttributes(
handle, hbaPort, discPort,
&discPortAttrs)) != HBA_STATUS_OK) {
fprintf(stderr, "Unable to get "
"discovered port %d attributes for "
"HBA %d with name "%s".
",
discPort, hbaCount, adaptername);
continue;
}
memcpy(&wwn, discPortAttrs.PortWWN.wwn,
sizeof (wwn));
printf(" Discovered Port %d: WWN=%016llx
",
discPort, wwn);
/* ... */
}
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard: FC-MI 1.92 (API |
| |version 1) |
+-----------------------------+-----------------------------+
| |Standard: FC-HBA Version 4 |
| |(API version 2) |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO
HBA_GetAdapterPortAttributes(3HBAAPI), HBA_OpenAdapter(3HBAAPI), libhbaapi(3LIB), attributes(5)
T11 FC-MI Specification
SunOS 5.10 1 Sep 2003 HBA_GetAdapterPortAttributes(3HBAAPI)