Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Questions and Answers



batch commands fail on TMSH shell

My goal is to run batch scripts from a central automation server, as we do to track other device/server types.  But I'm hitting a problem with the F5 TMSH shell.

My F5 admins setup a user account on one of our F5 BigIP version 10.1 devices, and configured it with tmsh terminal access. So when I login, it goes into TMSH.

All the commands work fine when issued interactively. But I see errors with putting the same commands in a batch script, for non-interactive access. Any lengthy command result yeilds two conditions that are not shown when you issue it interactively:
1) Only ~23 lines of output are displayed
2) The following two lines are at the top of the output:

WARNING: terminal is not fully functional
/var/tmp/tmsh/N3huSk/data (press RETURN)

So, for example, issuing a 'show /sys hardware field-fmt' command over a batch SSH connection, returns the following data (many more lines are shown when running the command interactively):
WARNING: terminal is not fully functional
/var/tmp/tmsh/N3huSk/data (press RETURN)
sys hardware chassis-fan-status-index 1 {
  fan-speed 10887
  index 1 status up 
sys hardware chassis-fan-status-index 2 {
  fan-speed 11637
  index 2
  status up
sys hardware chassis-fan-status-index 3 {
  fan-speed 11250
  index 3
  status up
sys hardware chassis-info {
  max-mac-count 2
  reg-key -

Before running any commands, I disable 'pager' settings... so that all the lines of output are returned to standard out instead of paging through less/more output (command: "modify /cli preference pager disabled"). If I don't do this, then interactively I have to press a key to continue the output.  Unfortunately, this doesn't fix the problem.

I am connecting on SSH (via Mindterm) with xterm configured as the terminal type. Keep in mind, this works fine when done interactively. With F5 using Linux on the backend, I figure this error might be suggesting that it doesn't know the terminal type. Unfortunately, I cannot get to bash from here to troubleshoot what's needed for TMSH batch access... e.g. look at configurations with files in the filesystem, run terminfo, set any environment variables from within TMSH, etc.

If someone could explain how to fix this issue, I certainly would appreciate it. Right now, batch commands are not working for this reason.


2 Answer(s):

I'm not sure what bits were just twiddled... but after logging into the F5 10.1 device interactively and validating the commands, my batch commands are returning as expected. Meaning from a batch SSH connection I am suddenly not seeing the terminal error, and the full output is being returned. No script changes were made. The only step between broken and functioning returns was an interactive login. Could this term information be coming from the interactive shell. No idea.

Anyway, if/when it fails again, I'll have an environment again to reproduce whatever you folks suggest.

my situation is sometimes the batch commands don't execute the first time they are run.. for some reason it requires doing the same thing a second time (running the job basically) to get the result.

i haven't worked with large number of commands so not sure where it might stop working. i send in perhaps a half dozen and they all work.. the only issue is the prompting on returned output.

Your answer: