Skip to main content
tonylin1
Staff
Staff
Jun 15, 2022 10:07 AM UTC

Technical Tip: How to add date into file name in automation to backup config daily

Description This article describes how to add a date to the file name in automation to back up the config daily.
Scope FortiGate.
Solution
  1. Create a trigger with the type 'Schedule':

 

config system automation-trigger

    edit "TFTP_Backup_Daily"

        set trigger-type scheduled

        set trigger-frequency hourly

        set trigger-minute 15

end

 

Create action 'CLI Script' where %%date%% is used: 

x.x.x.x is the TFTP server IP.

 

config system automation-action 

    edit "backup_date"

        set action-type cli-script

        set script "execute backup config tftp test%%date%%.conf x.x.x.x"

        set accprofile "super_admin"

end 

 

Refer to the Caution section of this KB article: Technical Tip: Automatic backup and precautions using date variables.

 

  1. Create a stitch: 

 

config system automation-stitch 

    edit "date_test"

        set trigger "TFTP_Backup_Daily"

            config actions

                edit 1

                    set action "backup_date"

                    set required enable

            end

end

 

Related article: 

Technical Tip: How to send automated backups of the configuration from a FortiGate with an automation stitch, using TFTP/FTP or SFTP Server and a recommendation for configuring a Linux machine

    Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
    Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT