Skip to content

Instantly share code, notes, and snippets.

@spxwnmc
Created June 8, 2021 04:43
Show Gist options
  • Save spxwnmc/99e5d248829b7fdaa881177d1e59f629 to your computer and use it in GitHub Desktop.
Save spxwnmc/99e5d248829b7fdaa881177d1e59f629 to your computer and use it in GitHub Desktop.
Backup incremental con rsync a servidor remoto
#!/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