Advertisement
urbinek

Untitled

Jan 24th, 2024
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #!/bin/bash
  2. backup_date=$(date +"%F")
  3. backup_dir=/backup/MikroTik-backup
  4. temp_dir=/tmp/MikroTik_$backup_date
  5.  
  6. mkdir -p $backup_dir $temp_dir
  7.  
  8. ssh admin-ssh@10.10.10.1 -i ~/.ssh/mikrotik_2048 "/system backup save dont-encrypt=yes name=cAP_$backup_date"
  9. scp -i ~/.ssh/mikrotik_2048 admin-ssh@10.10.10.1:/cAP_$backup_date.backup $temp_dir
  10.  
  11. ssh admin-ssh@10.10.10.2 -i ~/.ssh/mikrotik_2048 "/system backup save dont-encrypt=yes name=RB951G_$backup_date"
  12. scp -i ~/.ssh/mikrotik_2048 admin-ssh@10.10.10.2:/RB951G_$backup_date.backup $temp_dir
  13.  
  14. ssh admin-ssh@10.10.10.3 -i ~/.ssh/mikrotik_2048 "/system backup save dont-encrypt=yes name=RBcAPG_$backup_date"
  15. scp -i ~/.ssh/mikrotik_2048 admin-ssh@10.10.10.3:/RBcAPG_$backup_date.backup $temp_dir
  16.  
  17. cd $temp_dir/
  18. tar -czf $backup_dir/MikroTik_$backup_date.tar.gz *.backup
  19.  
  20. find $backup_dir -mtime +21 -exec rm {} \;
  21. rm -rf $temp_dir
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement