Created on
05-13-2022
09:21 AM
Edited on
07-01-2025
01:08 PM
By
Stephen_G
Description | This article describes how to configure automation stitch settings to generate configuration files with different names based on the date the script triggers. |
Scope | FortiGate v6.4.9+ and v7.0.2+GA releases, v7.2.4. |
Solution |
The following script will be triggered daily at 20:00 (according to the time configured on FortiGate).
config system automation-trigger edit "TFTP_Backup_Daily" set trigger-type scheduled set trigger-frequency daily set trigger-hour 20 next end
config system automation-action edit "backup_date" set action-type cli-script set script "execute backup config tftp Μy_Config_Name%%date%%.conf IP_Address Username Password" set accprofile "super_admin" next end
Note 1: For multiple VDOM Scenario (for example global VDOM):
set script "config global execute backup config tftp Μy_Config_Name%%date%%.conf IP_Address Username Password"
Or:
config global execute backup config tftp Μy_Config_Name%%date%%.conf IP_Address Username Password
For more information, refer to: Technical Tip: How to configure Automation Stitches for Multi VDOM for automated Firewall configurat...
config system automation-stitch edit "date_test" set trigger "TFTP_Backup_Daily" config actions edit 1 set action "backup_date" set required enable next end end
Μy_Config_Name2022-08-19
Note 2: In v7.2.4, %%date%% and %%time%% do not work as expected in an automation stitch. Use %%log.date%% and %%log.time%% instead.
config system automation-action edit "backup_date" set action-type cli-script set script "execute backup config tftp Μy_Config_Name%%log.date%%_%%log.time%%.conf IP_Address Username Password" set accprofile "super_admin" next end
Note 3: %%time%% or %%log.time%% not working for some of the TFTP/SFTP/FTP servers as it analyzed as bad characters for the title.
Here is the output:
Note 4: To check if the backup configuration is working with variables (date/ time) needs to be done using automation stitch only and does not change the variables if checking from CLI console or SSH.
Due to Windows limitations, the Windows FTP server will not allow file saves with ':' in them for automation stitch with variable date and time, therefore it will only save the configuration file name with variable date.
Note 5: FortiSwitches also support automation stitches. However, prior to versions 7.4.7 and 7.6.2, the variable '%%date%%' was not processed correctly. As a result, the stitch would not complete and backups would not be created. This behavior was fixed in the aforementioned versions and the feature is now available to be used. See the release notes about bug ID 1117174 under Resolve Issues.
Related article: |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.