09-26-2024 07:11 PM
Hello,
How we can make EEM Script to backup startup config to the SCP server with 2 condition :
Solved! Go to Solution.
09-27-2024 12:07 AM
Hello @hs08
To handle both conditions properly—one triggered by write memory and one for the weekly backup at 10 PM on Sundays—you will need two separate EEM applets. Unfortunately, there's no way to have two distinct triggers (events) in a single applet, as EEM supports only one event statement per applet.
event manager applet BACKUP_ON_WRITE_MEMORY
description "Backup startup-config to SCP when 'write memory' is issued"
event cli pattern "write memory" sync yes
action 1.0 cli command "enable"
action 1.1 cli command "copy startup-config scp://username:password@<scp-server-ip>/backup-write-memory-config.cfg"
action 1.2 syslog msg "Configuration backup completed after write memory."
---
event manager applet WEEKLY_BACKUP
description "Backup startup-config to SCP every Sunday at 10 PM"
event timer cron cron-entry "0 22 * * 0"
action 1.0 cli command "enable"
action 1.1 cli command "copy startup-config scp://username:password@<scp-server-ip>/weekly-backup-config.cfg"
action 1.2 syslog msg "Weekly configuration backup completed."
09-27-2024 12:07 AM
Hello @hs08
To handle both conditions properly—one triggered by write memory and one for the weekly backup at 10 PM on Sundays—you will need two separate EEM applets. Unfortunately, there's no way to have two distinct triggers (events) in a single applet, as EEM supports only one event statement per applet.
event manager applet BACKUP_ON_WRITE_MEMORY
description "Backup startup-config to SCP when 'write memory' is issued"
event cli pattern "write memory" sync yes
action 1.0 cli command "enable"
action 1.1 cli command "copy startup-config scp://username:password@<scp-server-ip>/backup-write-memory-config.cfg"
action 1.2 syslog msg "Configuration backup completed after write memory."
---
event manager applet WEEKLY_BACKUP
description "Backup startup-config to SCP every Sunday at 10 PM"
event timer cron cron-entry "0 22 * * 0"
action 1.0 cli command "enable"
action 1.1 cli command "copy startup-config scp://username:password@<scp-server-ip>/weekly-backup-config.cfg"
action 1.2 syslog msg "Weekly configuration backup completed."
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide