Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- user="admin"
- address="IP"
- #command will get devcie hostname in complex form
- ssh $user@$address '/system identity print interval=' > devices
- #will get device hostname
- tmpDevices=$(cat devices)
- device=$(echo $tmpDevices | awk ' {print $2} ')
- echo "Device hostname is $device"
- echo "Connecting to device via SFTP and downloading files"
- #sftp "${user}@${address}:/${device}*"
- sftp $user@$address:$device*
- Device hostname is MikroTik
- MikroTik
- Connecting to device via SFTP and downloading files
- Connected to 10.120.0.253.
- File "/MikroTik" not found.
Add Comment
Please, Sign In to add comment