Simple loop for ip-range and repeat a command? Please help!
hi fam,
I'm on a jump host. I now set the command "ssh 192.168.178.1 readscript -c> ~ / backupscript.txt". After that, anything can happen. Accept timeout, password, login, host key and so on. If all is well, the "Password:" query comes and my password should be used automatically. At this moment a "readscript" is sent to the 192.168.178.1 and written to the "backupscript.txt" file. I now need a loop that repeats this for a lot of devices and also catches errors like timeout. It would also be nice if the file name includes the name of the IP address or something similar. If there is a more elegant way of solving this via SFTP, I would be grateful for ideas. Unfortunately, I have no idea where exactly to start. If you still need information, just ask.
Thank you
Jack
|