Esse é o arquivo que uso para fazer backup do WordPress em hospedagens compartilhadas (tipo Locaweb, Hostgator, GoDaddy, etc).
#!/bin/bash PASTA_RAIZ=`pwd` TIMESTAMP_ATUAL=`date +%Y-%m-%dT%H:%M:%S` ORIGEM_BKP="${PASTA_RAIZ}/public_html" DESTINO_BKP="${PASTA_RAIZ}/backups/${TIMESTAMP_ATUAL}_wp_code.tgz" WORDPRESS_UPLOADS="${ORIGEM_BKP}/wp-content/uploads" # Handle different tar version bugs https://unix.stackexchange.com/questions/32845/tar-exclude-doesnt-exclude-why # Unbelievable! It turns out that an older version of tar (1.15.1) would only exclude if the top-level dir # is last on the command line. This is the exact opposite of how version 1.23 requires. FYI. COMANDO_EXCLUSAO="--exclude=${WORDPRESS_UPLOADS}" COMANDO_BACKUP_SEM_UPLOADS="/bin/tar -czpf ${DESTINO_BKP} ${COMANDO_EXCLUSAO} ${ORIGEM_BKP}" DESTINO_BKP_UPLOADS="${PASTA_RAIZ}/backups/${TIMESTAMP_ATUAL}_wp_uploads.tgz" COMANDO_BACKUP_UPLOADS="/bin/tar -czpf ${DESTINO_BKP_UPLOADS} ${WORDPRESS_UPLOADS}" #Executando o comando de backup echo 'Executando backup sem uploads' echo ${COMANDO_BACKUP_SEM_UPLOADS} echo ${COMANDO_BACKUP_SEM_UPLOADS} >> no-upload.log ${COMANDO_BACKUP_SEM_UPLOADS} echo 'Executando backup com uploads' echo ${COMANDO_BACKUP_UPLOADS} echo ${COMANDO_BACKUP_UPLOADS} >> upload.log ${COMANDO_BACKUP_UPLOADS}