daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. user="admin"
  3. address="IP"
  4. #command will get devcie hostname in complex form
  5. ssh $user@$address '/system identity print interval=' > devices
  6.  
  7. #will get device hostname
  8. tmpDevices=$(cat devices)
  9.  
  10. device=$(echo $tmpDevices | awk ' {print $2} ')
  11. echo "Device hostname is $device"
  12.  
  13. echo "Connecting to device via SFTP and downloading files"
  14. #sftp "${user}@${address}:/${device}*"
  15. sftp $user@$address:$device*
  16.    
  17. Device hostname is MikroTik
  18. MikroTik
  19. Connecting to device via SFTP and downloading files
  20. Connected to 10.120.0.253.
  21. File "/MikroTik" not found.
RAW Paste Data
Top