Hi community
I'm trying to build a script using perl which uses the vnmsh. The script should connect using $SPECROOT/vnmsh/connect and later read some attributes from some models for further analisis. Now I've got the script almost operational but some actions seem to fail in bash so I go to perl. I'm not a scripting/bash/perl guru but typically I get around just enough to simplify the job I'm doing.
this is the script so far, it should only give back the modelhandles for all models in a certain collection. The seek command works fine if I execute it from a bash script.
#!/usr/bin/perl
$CLIPATH="/opt/Spectrum/vnmsh";
system("$CLIPATH/connect ");
system("CLISESSID=$$"); # Define the CLISESSID variable to a
system("export CLISESSID"); # unique value and export it.
print "DEB: connected to database\n";
# get the list of interface model handles and store in @modelhandle
@modelhandle = `$CLIPATH/seek attr=0x12adb,val=*zzz-somecollectioname* | tail -n +2 | awk '{print $1}'`;
system("$CLIPATH/disconnect");
print "DEB: disconnected from database\n";
I run the script and get the following output
connect: successful server-xyzxyz
current landscape is 0x300000
WARNING: CLI is a powerful tool that allows a user to make changes
directly to the SPECTRUM knowledge-base without the error checking
provided by OneClick. Please read the accompanying CLI user
documentation before using the create, destroy, or update commands.
DEB: connected to database
Please connect first
disconnect: successful from server-xyzxyz - connected for 0 hours, 0 minutes
DEB: disconnected from database
I split the output in 3 parts,
1st sections shows that I'm connected,
2nd section wants to do the seek command but fails with reason "Please connect first"
3rd section disconnects successfully (even while one line before I get an error stating that I need to connect first??)
I'm a bit lost here, any a hint or even better, the answer?
thanks in advance
Hans