Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- backup_date=$(date +"%F")
- backup_dir=/backup/MikroTik-backup
- temp_dir=/tmp/MikroTik_$backup_date
- mkdir -p $backup_dir $temp_dir
- ssh admin-ssh@10.10.10.1 -i ~/.ssh/mikrotik_2048 "/system backup save dont-encrypt=yes name=cAP_$backup_date"
- scp -i ~/.ssh/mikrotik_2048 admin-ssh@10.10.10.1:/cAP_$backup_date.backup $temp_dir
- ssh admin-ssh@10.10.10.2 -i ~/.ssh/mikrotik_2048 "/system backup save dont-encrypt=yes name=RB951G_$backup_date"
- scp -i ~/.ssh/mikrotik_2048 admin-ssh@10.10.10.2:/RB951G_$backup_date.backup $temp_dir
- ssh admin-ssh@10.10.10.3 -i ~/.ssh/mikrotik_2048 "/system backup save dont-encrypt=yes name=RBcAPG_$backup_date"
- scp -i ~/.ssh/mikrotik_2048 admin-ssh@10.10.10.3:/RBcAPG_$backup_date.backup $temp_dir
- cd $temp_dir/
- tar -czf $backup_dir/MikroTik_$backup_date.tar.gz *.backup
- find $backup_dir -mtime +21 -exec rm {} \;
- rm -rf $temp_dir
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement