Ecco come ho preparato un comodo script per fare il backup dell’archivio di Plone e subito dopo copiare il backup compresso con TAR in un server FTP senza lasciare nel webserver il file tgz
#!/bin/bash
PLONEPATH="/home/zope/plone32" # where you have your buildout.cfg
REPOZOPATH="${PLONEPATH}/bin/repozo"
DATAFSPATH="${PLONEPATH}/var/filestorage/Data.fs"
DESTINATION="/home/zope/backup/repozo"
DBBACKUP="${REPOZOPATH} -BzQ -r ${DESTINATION} -f ${DATAFSPATH}"
FTP_SERVER_IP="192.168.1.21"
FTP_DESTINATION="dir1/subdir1"
PYTHONPATH="${PLONEPATH}/parts/zope2/lib/python"
export PYTHONPATH # otherwise repozo.py will probably not be able to find its libraries
DATA=`expr $(date +%d)`
RESTO=`expr ${DATA} % 2` # 2 set backup, on even and odd days
DIRNAME_DESTINATION=`dirname ${DESTINATION}`
BASENAME_DESTINATION=`basename ${DESTINATION}`
`${DBBACKUP}`
ftp -n ${FTP_SERVER_IP} <<ENDSCRIPT
user ftp_user ftp_password
binary
put "| /bin/tar -czf - -C ${DIRNAME_DESTINATION} ${BASENAME_DESTINATION}" ${FTP_DESTINATION}/backup_${RESTO}.tgz
bye
ENDSCRIPT


