Showing results for 
Search instead for 
Did you mean: 

AMA-CUCM Troubleshooting: Best Practices for Reading Trace Files


Comments in CLI script

Is there some word or character in CUCM CLI that signifies a comment? 

I want this every few months when I'm doing CLI work.


I've guessed at several and none work. 

I googled and didn't find anything.

I emailed a UC engineer who said 'no such thing'. 

That can't be true, can it?


  • !---CLI comment, nope
  • #--- what is the CLI comment signifier? nope
  • >> script for for identifying nodes<<
  • @--this script identifies the node
  • show myself
  • show network eth0
  • show date


Yeah, I know I can just enter something that I know is not a command like:

  • == put your comment here

and get the 'invalid command' error, but I don't want the clutter in the log files.

Everyone's tags (3)
Rising star

Re: Comments in CLI script

The CLI that you are presented with when you SSH to a UC box is a java based command interpreter. I do not think that it has any provision to make a comment, I also can't really think of a good reason to have a "comment" ability within the CLI. Sorry, I know this is not the answer you were looking for, but pretty sure this is not possible.


Re: Comments in CLI script

>> I also can't really think of a good reason to have a "comment" ability within the CLI


I just gave you a good reason.  Have you never done repetitive work on multiple nodes?


And any CLI should have a provision for comments.




Rising star

Re: Comments in CLI script

The question was not a stupid by any means, I apologize if my reply came across as abrasive, that was not my intent. I do a decent amount of work with Cisco UC products and have never had a need to insert comments directly into the CLI, I responded honestly.


If you do a lot of repetitive CLI work on multiple hosts, I would recommend using something like an expect shell script. You can insert comments into your shell script without needing to "send" them as commands in the UCOS CLI session. Here is an example which shows how you can build an expect script to interact with the CUCM CLI and comment freely within the script (in this case # is used since it is a shell script):


#!/usr/bin/expect -f
set timeout 120
set username [lindex $argv 0]
set password [lindex $argv 1]
set hostname [lindex $argv 2]

# Begin expect block
spawn ssh $username@$hostname

# The following statement will automatically accept the SSH connection warning if presented
expect {
	"Are you sure you want to continue connecting (yes/no)?" {
		send "yes\r" # Test midline comment
# The following statement will enter the password for the specified user account
	"administrator@$hostname's password:" {
		send "$password\r"
		expect "admin:"
# The following will dump the risdb phone data for the current UCM node and then drop the shell into
# interactive mode
		send "\r\r\rshow risdb query phone\r"



Everyone in this community who responds to threads does so on their own personal time in an effort to help others get answers to their questions. I think you would be hard pressed to find someone who genuinely had a negative intent in trying to provide a solution.


I hope this helps!


- Jon


Re: Comments in CLI script

Ah, Expect!  Yes.  That was the first thing I thought of, but I don't have a Linux box that can reach these nodes.  I'm stuck with Windows. 


I looked into Powershell, and there was an Await plug-in that was designed to mimic Expect, but it's apparently deprecated (or I couldn't figure out how to load it.) 


Then I tried it with 'plink' but really needed the 'expect ' functionalities. I was wrestling with delays and gave up.


Then I discovered SecureCRT (SCRT) running VBScript has "send" and "wait for string' (similar to Expect functionality) which works well enough.  So I run all the commands and collect the results in the SCRT log. 


However looking at the log of 100 machines, I don't know which accounting group I'm looking at, so I added "== primary accounting group xxxxxxxxx" to the commands, and now, when I look through the logs I can tell which machine and group I'm looking at.  It makes analysis a lot easier. 


So this works, except I get the error message below every entry.  If I could flag it as a comment it shorten my log by a few hundred lines and make it easier to read as well.


Thanks for your reply. 

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards