Junos OS

last person joined: yesterday 

Ask questions and share experiences about Junos OS.
  • 1.  event options "commands file copy"

    Posted 11-30-2010 05:00

    Hi all,

     

    I have a problem with event options.

     

    I configured as following.

     

    ----------------------------------------------------------------------------

     

    policy copy {
        events snmp_trap_link_up;
        attributes-match {
            snmp_trap_link_up.interface-name matches "lo0$";
        }
        then {
            execute-commands {
                commands {
                    "file copy /cf/var/home/blahblahblah /cf/var/tmp";
                }
            }
        }
    }
    ---------------------------------------------------------------------------

     

    ***blahblahblah is a file name.

     

    however it does'nt work.

     

    I could execute command such as request system ----- or something like that, but I cannot execute file command.

     

    Does somebody know how should I configure?

     

    Thank you,

     




  • 2.  RE: event options "commands file copy"
    Best Answer

     
    Posted 11-30-2010 05:22

    Hi,

     

    Configuring "output-format text" under [event-options policy copy then execute-commands] should make the "file copy" work.

     

    Most of the cli commands works well in both the xml and txt format. But there are very few commands which works only with text format, (one among them is "file copy"). Thats why the file copy did not work with the default xml format. Changing the output-format to text should work.

     

    Thanks,

    Sriram

     



  • 3.  RE: event options "commands file copy"

    Posted 11-30-2010 05:37

    Hi Sriram,

     

    Thank you so much for your help.

     

    I could do it. Thank you so much.

    I really appreciate that.



  • 4.  RE: event options "commands file copy"

    Posted 09-30-2015 20:37

    Old post i know, but I just wanted to thank you for this, I have been battling with it all day and could not work out why the file copy was not working.  Where is this mentioned so one can learn which commands need to be submitted as text and some as XML.  Why would you use XML at all if you're wanting to replicate what you can type in operational mode as notionally you test the commands you want to use first then just add them into your script assuming that if they work manually they will work via script (which as above, is not the case)

     

    Anyway.. thanks for the info 🙂