Actualizo éste script/post para que si por algún motivo no pueda conectar con el router mikrotik haga timeout y siga con el Backup.
root@xava-ftp:~/scripts# cat /root/scripts/backup_mikrotiks_SN.sh
#!/bin/bash
############################################
# SCRIPT CREATED BY: Laura Mora i Aubert #
# SCRIPT DATE: 2019-11-27 #
# WEBSITE: https://blackhold.nusepas.com #
# INFO: Script that allows remote backup #
# of Mikrotik Routers. #
# tested on 5.x & 6.x routers #
# LICENSE: creative commons (by:sa) #
############################################
############################################
# INSTRUCTIONS #
############################################
# #
# 1. Generate ssh-keys on your server #
# cd ~/.ssh #
# sh-keygen -t dsa #
# #
# 2. Rename pubkey #
# cp .ssh/id_dsa.pub backupkey #
# #
# 3. Put the file on MKT Router #
# ftp x.x.x.x #
# ftpbin #
# ftpput backupkey #
# ftpbye #
# #
# 4. Import pubkey in MKT Router #
# telnet x.x.x.x #
# [admin@mikrotik] /user ssh-keys\ #
# import user=admin\ #
# public-key-file=backupkey #
# #
# 5. Access with ssh to the MKT Router #
# #
# 6. [SCRIPT] Change USER and ID values #
# #
# 7. Run the script! #
# #
############################################
############################################
# OTHERS #
############################################
# #
# If you have bruteforce login rules, #
# add your backup server IP in the last #
# rule: src-address=!SERVERIP #
# #
############################################
# Change username
USER=blackhold
BACKUP_DIR="/root/backups/capa8"
if [ ! -d "${BACKUP_DIR}" ]; then
mkdir -p ${BACKUP_DIR}
fi
cd ${BACKUP_DIR}
# delete …

