Created on 05-13-2022 09:21 AM Edited on 11-25-2024 07:35 AM 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, 7.2.4. |
Solution |
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
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: 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: %%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: 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. |
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 2024 Fortinet, Inc. All Rights Reserved.