Posted on September 17, 2020 2:09 pm
 |  Asked by walter bernardo
 |  78 views
0
0
Print Friendly, PDF & Email

How do I automate scping the configs to a destination?

copy run scp:[username]@[ip address]/[directory]/[configuration file name]

I think this copies it to a defined location but is there a way to make this command run once a week ?

1
Posted by Sreelekha
Answered on September 18, 2020 10:09 am

Hi Walter,

Thanks for writing to us. You can use a simple cron job to automate backup log collection.

Below is an example from my lab:

bri500...10:03:18#bash
[admin@bri500 ~]$ sudo su
bash-4.2# crontab -e
* * * * * FastCli -p 15 -c "copy running-config scp:admin@10.85.128.91:/mnt/flash/weektest"

=============================================================================================

The above task saves the config every minute to the remote location as below

[admin@bri501 weektest]$ ls -ltr
total 144
-rw-rw-r--+ 1 admin eosadmin 8629 Sep 18 09:25 tmpgnBVVQ
-rw-rw-r--+ 1 admin eosadmin 8629 Sep 18 09:26 tmp0mUWox
-rw-rw-r--+ 1 admin eosadmin 8629 Sep 18 09:27 tmpqNaPIM
-rw-rw-r--+ 1 admin eosadmin 8629 Sep 18 09:28 tmpGe57IQ
-rw-rw-r--+ 1 admin eosadmin 8629 Sep 18 09:29 tmpPDrL21
-rw-rw-r--+ 1 admin eosadmin 8629 Sep 18 09:30 tmpi8JdPt

The interval is decided by the fields "* * * * *" preceding the command. Here the fields "A B C D E" correspond to "min hours days months days_of_week"

As you want to run it weekly, you can simply use the keyword "@weekly" or choose to customise the day/time using the above mentioned fields. Few examples are available here https://www.tecmint.com/create-and-manage-cron-jobs-on-linux/

Hope this helps!
Sreelekha

Post your Answer

You must be logged in to post an answer.