Lsvterm? for running LPAR

Hello,
I've only been working with IBM systems for a short period and can't find this answer.

Our software requires you to use the virtual console on occasion. I've created scripts to help list, remove, and make a virtual terminal for an HMC-managed Power system.

Is there any method to see who (and maybe where) might be using the virtual console before rudely bumping them off? (Reasoning for this as well, I might have automation running in that console and I don't want to kick it off.)

# Check the state of the LPAR
function GetLparListF {
servers=$( lssyscfg -r sys -F name )
for server in $servers;do
  echo "# $server #"
  lssyscfg -m $server -r lpar -F lpar_id,name,state,rmc_ipaddr
  echo
done
}

# Remove virtual terminal
function RemoveTermF {
partName=$1
servers=$( lssyscfg -r sys -F name )
for server in $servers;do echo "# $server #";
  rmvterm -m $server -p $partName && echo
done
}

# Make virtual terminal
function MakeTermF {
partName=$1
servers=$( lssyscfg -r sys -F name )
for server in $servers;do echo "# $server #";
  mkvterm -m $server -p $partName && echo
done
}
MakeTermF <LPAR Name>
# <system> #

 A terminal session is already open for this partition.
 Only one open session is allowed for a partition.
 Exiting....

Welcome!
I have no real experience with the HMC...
Perhaps you can simply connect to the existing virtual console?
Then perhaps you share the running session, and see what's going on?

Does mkvterm emit a message or return a non-zero exit status if there's already a vt ? - if so they can be trapped and then actioned. Documentation is dire IBM Documentation

mkvterm -m <server> -p <lpar_name>

 A terminal session is already open for this partition.
 Only one open session is allowed for a partition.
 Exiting....  Received end of file, Exiting.
                                            hscroot@<hmc_hostname>:~> echo $?
0

Above is a verbose output if the vterm already exists. As you can see, if it already exists, it's a clean exit.

mkvterm -m <server> -p <non-existing_lpar>
HSCL8012 The partition named made_up was not found.  Please check your entry and retry the command.
hscroot@<hmc_hostname>:~> echo $?
1

I adjusted the code snip on the original post, the first function name was clipped causing it to be technically broken.

Because I do everything do a jump box, I can't tell you what the exit code is of ~. -- my original SSH session from the jump box terminates the SSH session to the HMC.

Keep the intent in mind. This is being done with as much automation and no manual work. Although I could ssh to the host and do a portmir as you are suggesting to see what they're doing, the intent is who and where.

Because the lscons would be vty0, vty0 would fail to display my two answers.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.