05-22-2019 10:08 AM
I have looked and cant figure out how to do the following in a EEM file.
If i have a command just as,
action 1.1 cli command "show platform software status control-processor brief | append bootflash:/rpcpu1min.txt"
How can i proceed this command with a header so when the EEM applet emails me the file i know what command was executed to obtain that result. It would be great if i can just append/echo a command to the file before executing the above command. How can i accomplish this.
Also it seems like EEM doesn't like more than one pipe | per command is there a way to use multiple pipes? for example the following command will not work with cli command with double pipes.
sh proc cpu sort | in xxx | append bootflash:/rpcpu1min.txt
TIA, Paul
05-22-2019 02:07 PM
Hi there,
If I am understanding you right, why not assign the cli command to a variable and then reference it in the applet. Like:
action 0.1 set CMD01 "show platform software status control-processor brief | append bootflash:/rpcpu1min.txt"
action 1.1 cli command "$CMD01
...you can then use $CMD01 elsewhere.
cheers,
Seb.
05-28-2019 07:28 AM
problem is when you have multiple pipes in the command it doesnt work.
show in desc | in something | append flash:/file name
The above command doesnt seem to work with multiple pipes.
Paul
05-29-2019 12:30 AM
Hi Paul,
As you have discovered the function of the second pipe differs from what you expect in a UNIX terminal. The second pipe is actually an OR operator.
If you just want to write a string to a file outside of the action cli command statement, then you will need to assign the result to a variable and use the action file command. Something like this (untested!!) :
action 0.1 set CMD01 "show platform software status control-processor brief | append bootflash:/rpcpu1min.txt" action 1.1 cli command "$CMD01" action 1.2 file open fh flash:some_output.txt w action 1.3 file write fh $_cli_result action 1.4 file close fh
I don't have an IOS device nearby to test this on, so I look forward to hearing back from you :)
cheers,
Seb.
05-29-2019 07:06 AM
Seb, Thank you I will test and post results to the group, reading the doc you sent me it should work.
Paul
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide