Created
June 8, 2021 04:43
-
-
Save spxwnmc/99e5d248829b7fdaa881177d1e59f629 to your computer and use it in GitHub Desktop.
Backup incremental con rsync a servidor remoto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DATE=$(date +"%d/%m/%y %H:%M") | |
SSH_USER=spawn | |
SSH_IP=192.168.100.45 | |
REMOTE_FOLDER=/home/spawn/backups/docs | |
FOLDER_BACKUP=~/Documentos/ | |
respaldo(){ | |
sudo rsync -avz -e 'ssh -p 3777' $FOLDER_BACKUP ${SSH_USER}@${SSH_IP}:${REMOTE_FOLDER} | |
} | |
if [[ -d ~/Documentos ]] ; then | |
echo "El directorio existe." | |
echo "Fecha del respaldo: ${DATE}" | |
respaldo | |
else | |
echo "El directorio no existe, no hay nada que respaldar." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment