[j-nsp] batch on junos ?
Phil Shafer
phil at juniper.net
Fri Jan 31 10:27:08 EST 2014
Depending on your purpose and whether this is a one-off or a
continuing need, JUNOS has a number of tools to help you.
For a simple command, others have already pointed out that
you can pipe commands to ssh. You can also use a command
line to give multiple commands:
ssh my-router "configure; set system host-name foo; commit"
For a longer-term need, you can make scripts using the JUNOS Automation
features (notably "op" scripts):
var $connection = jcs:open();
var $configuration = <configuration> {
<system> {
<host-name> "foo";
}
}
var $res = jcs:load-configuration($connection, $configuration);
The "jcs:load-configuration" template will load and commit the
contents of the $configuration variable.
For more information, see the "Recommended Reading" sidebar on:
https://www.juniper.net/us/en/community/junos/script-automation/
Also note that you can now run script in SLAX (the language used for
on-box scripting) using the "juise" package (github.com/Juniper/juise).
Thanks,
Phil
R S writes:
>Is there a way to run a sort of .bat on SRX junos ?
>
>I mean, to run a single command from cli to do some actions (set xxx/ set yyy/ commit ch
>eck / commit) ?
>
>This is useful to be runned by NOC for scheduled action every day.
>
>Tks
>
>
>
>_______________________________________________
>juniper-nsp mailing list juniper-nsp at puck.nether.net
>https://puck.nether.net/mailman/listinfo/juniper-nsp
More information about the juniper-nsp
mailing list