12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #!/bin/bash
- scheme="https://"
- url="backup.castanedo.es"
- httpuser="authbasicuser"
- httppass="authbasicpasswd"
- backupDir=/home/$USER/Documentos/backup
- if [ ! -d $backupDir/$url ];then
- mkdir -p $backupDir/$url
- if [ $? != 0 ];then
- printf "ERROR: Imposible crear %s\n" $backupDir/$url
- exit 1
- fi
- fi
- if [ -f $backupDir/$url/index.html ];then
- rm $backupDir/$url/index.html
- if [ $? != 0 ];then
- printf "ERROR: Imposible borrar %s\n" $backupDir/$url/index.html
- exit 1
- fi
- fi
- printf "Destino backups:\t%s\n" $backupDir
- printf "Sincronizando backup's desde %s\n" $scheme$url
- wget -q --tries=3 -r -c --user=$httpuser --password=$httppass --directory-prefix=$backupDir $scheme$url
- if [ $? != 0 ];then
- printf "ERROR: Se han producido errores en la sincronizacion\n"
- exit 1
- fi
- printf "Descarga correcta :)\n"
|