Automated FortiGate backups with time stamps, encryption, and notifications
We're using the script below to backup our FortiGates, but it creates only one backup file name. We'd like to keep the last 5 backups, which we can manage with a cron job. How do we append the time date/timestamp to the script? We'd like to ensure the backup files are encrypted, so is there a way to encrypt the files? We'd also like to be notified if the backups were successful or not, so is there a way to incorporate this? Thank you.
Step 1:
config system automation-trigger
edit "Backup"
set trigger-type scheduled
set trigger-frequency daily <----- Frequency of the action.
set trigger-hour 23 <----- Hour of the triggered action.
set trigger-minute 58 <----- Minute of the triggered action.
next
end
Step 2:
config system automation-action
edit "Backup"
set action-type cli-script
set minimum-interval 0 <----- Limit execution to no more than once in this interval (in seconds).
! set delay 0 <-----Delay before execution (in seconds).
! set required enable
set script "execute backup config sftp /ftg_backup.conf 1.1.1.1 username password
next
end
Step 3:
config system automation-stitch
edit "Backup"
set status enable
set trigger "Backup"
config actions
edit 1
set action "Backup"
next
next
end
