1752794 Members
6035 Online
108789 Solutions
New Discussion юеВ

STM and its syntax

 
Willem Polder_1
Occasional Contributor

STM and its syntax

On recording the stm syntax for the sc command (using rcf and srcf) I find the executed commands (as recorded) are not accepted in a cmd-file.
I want to select, in as few commands as possible, all interface-cards visible from the queried server.
It must be a bug, but if there is someone out there who has a workaround, I would definitely appreciate it!
5 REPLIES 5
RolandH
Honored Contributor

Re: STM and its syntax

If you have know the number of the device, you can do this.

i.e. the number from the first interface is 10 in the displayed map (cstm> map)

then you can do this

# echo "seldev 10;info;wait;il"|cstm


Hope it helps !

Roland
Sometimes you lose and sometimes the others win
Willem Polder_1
Occasional Contributor

Re: STM and its syntax

I am sorry, but I have to do this regularly on all our servers, so I do need something more flexible. Thanks anyway for the effort!
RolandH
Honored Contributor

Re: STM and its syntax

Then try this

echo "selclass qualifier lan;info;wait;il"|cstm

Roland
Sometimes you lose and sometimes the others win
RolandH
Honored Contributor

Re: STM and its syntax

I forgot something. You ask for all Interfce cards. For that you have to know the kind interfaces, which you have installed in the system and the use the qualifier for that kind of interface. If you have not such interfce in the system you will get no info for that.

qualifier:

lan
fibre
scsi
memory
etc...

you will get all qualifier types if you start the cstm as root
#cstm
cstm> selclass
-- Select Class of Devices --
Select only Device Type:
* 1 All
2 Adapter
3 Disk
4 Hub
5 Interface
6 Memory
7 Processor
Enter selection [1]: 5

Select only Qualifier Type:
* 1 All
2 Audio
3 Bus
4 CPU
5 Centronics
6 Graphics
7 Hard
8 IDE
9 LAN
10 Memory
11 RS-232
12 SCSI
13 USB
Enter selection [1]:


As you can see there is no fibre qualifier. This is my example system has no fibre interface. So choose a system with a lot of different interfaces and you will see all available qualifiers on the system.

HTH
Roland
Sometimes you lose and sometimes the others win
Ralph Grothe
Honored Contributor

Re: STM and its syntax

Willem,

I myself stumbled a couple of times over the cstm syntax,
and I firmly believe that at least cstm's online help is somewhat faulty.

If you don't mind the cost of two cstm invocations you could throw these few lines into a Perl script.
However, you'd probably might want to put something more suitable in the while loop's body than just printing cstm's output as I did here:


@devs = map {/^\s+(\d+).+LAN/} qx(echo map|/usr/sbin/cstm);
die "oops, selection of NICs failed" unless @devs;
open CSTM, "echo \"sel dev @devs;info;wait;il\"|/usr/sbin/cstm |"
or die "cannot pipe from cstm";
print while ();
close CSTM;
Madness, thy name is system administration