Support Support Downloads Knowledge Base Juniper Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[Archive] How to automate configuration backup on E Series routers

0

0

Article ID: KB30841 KB Last Updated: 25 Apr 2020Version: 2.0
Summary:

This article describes a script, which will collect the configuration of E Series routers and upload it to an FTP server for backup.  This script will also provide E Series customers that require automatic backups with the ability to customize the frequency at which the backup occurs.  The script can save both a binary and text version of the configuration.

Solution:

Automation Procedure

The steps required for automating the configuration backup activity are as follows:

  1. Create a macro file (*.mac extension).
  2. Copy and past script into macro.

  3. Create FTP host:

    host <FTP server name> <FTP server IP address> ftp <username> <password>
     
  4. Save file to SRP disk0:

    copy <FTP server name>:/<# macro file name #>.mac <# macro file name #>.mac
     
  5. Verify transfer was successful:

    dir disk0:<# macro file name #>.mac
     
  6. Configure the frequency at which the macro should run:

    schedule macro interval frequency <value in minutes> <# macro file name #>.mac
     
  7. Verify configured schedule:

    show schedule macro

Customizable script

Here is a template script that can be customized to automate configuration backup activities.

// Script //

<# start #>

<# env.startCommandResults #>
show clock
<# env.stopCommandResults #>

<# date := env.getResults #>
<# date1 := substr (date, 0, 15) #>
<# month := substr (date, 4, 3) #>
<# day := substr (date, 8, 2) #>
<# year := substr (date, 11, 4) #>
<# file_name := "BSR-E320-1" $ day $ mahina $ year #>

<# setoutput console #>

File name is <# file_name #>
Requesting .CNF file

<# endsetoutput #>

copy running-configuration <# file_name #>.cnf

<# setoutput console #>

Requesting .SCR file

<# endsetoutput #>

show configuration > <# file_name #>.scr

<# setoutput console #>

Sending both files to FTP Server

<#endsetoutput #>

copy <# file_name #>.cnf ftpserver:/juniper/eseries/<# file_name #>.cnf
copy <# file_name #>.scr ftpserver:/juniper/eseries/<# file_name #>.scr

<# setoutput console #>

Done

<#endsetoutput #>
show clock

<#endtmpl#>

 

Modification History:

2020-04-25: Archived

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search