SSH batch mode
Hi everybody,
I need to save the running config of my switches every night while I make big changes in my network configuration (a big network migration task).
To do this, I have on a Linux-Server a user who has credentials to log in to my switches. This user should run now a shell script to gather the configs.
the script is
#! /bin/bash
ssh ansible@l2acsw3.lsn << END
enable
top_secret_password
show show running-config
exit
exit
END
The log-in is successfull as stated in the logfile of the switch (multiple tries):
Jan 19 11:39:15 2024-01-19 11: 39:15 l2acsw3 53015 Logout the CLI by cfgrdr on ssh (192.168.134.166).
Jan 19 11:39:29 2024-01-19 11: 39:29 l2acsw3 53015 Logout the CLI by cfgrdr on ssh (192.168.134.166).
Jan 19 11:39:39 2024-01-19 11: 39:39 l2acsw3 53015 Logout the CLI by cfgrdr on ssh (192.168.134.166).
Jan 19 11:47:04 2024-01-19 11: 47:04 l2acsw3 53015 Logout the CLI by cfgrdr on ssh (192.168.134.166).
I'm not sure if it is the phase of entering the enable password what crashes ...
Any ideas how to automatically read the config via SSH?
Thanks in advance
Erich