Hi Troels, For backing up the relax wiki (http://wiki.nmr-relax.com), should I run both this script and the MySQL dumping script at http://article.gmane.org/gmane.science.nmr.relax.devel/4163? Will the FTP script get the MySQL database contents? I could create one script to run both scripts, and then upload using rsync to the relax download site. I have now added this script to the relax sources as devel_scripts/wiki_ftpdump.sh. Cheers, Edward On 17 July 2013 13:24, Troels Emtekær Linnet <tlinnet@xxxxxxxxx> wrote:
Dear relax developers and users. I hereby send a bash script for a FTP dump of the newly create relax wiki. Thereby the wiki can easily be created anywhere else, if created together with the mysql database. To prevent abuse of the webpage hosting service, I need to keep the password secret. The password is shared with Edward d'Auvergne. I suggest a setup, where Edward run a cronjob a his infrastructure, and expose the files to: http://download.gna.org/relax/wiki/ftpdump The FTP dump should only tricker when new files are added. That would normally only be when images are uploaded. Best Troels Linnet ----------------------- #!/bin/bash # -*- coding: UTF-8 -*- # Script for dumping ftp server automatically using cron. # exec test exec_test () { [ $? -eq 0 ] && echo "-- Command successfully executed" || echo "-- Command failed; exit 1" } # Filenames dbhost="web3.gigahost.dk" # The following two fields are kept secret, to prevent abuse. # Please contact Troels Linnet at: tlinnet _at_ gmail dot com, for access. dbuser="secret" dbpwd="secret" mydate=`date '+%Y%m%d_%H%M'` mytime=`date '+%T %Y%m%d'` backupfolder="${HOME}/backup/ftpdump" backupfoldermirror="${backupfolder}/mirror" backupfoldercurrent="${backupfolder}/current" mkdir -p $backupfolder $backupfoldermirror $backupfoldercurrent # Logging exec 3>&1 4>&2 trap 'exec 2>&4 1>&3' 0 1 2 3 exec 1>>${backupfolder}/ftpdump.log 2>&1 # Everything below will go to the log file dump_base () { echo "###########################" echo "STARTING on: $mytime" echo "Mirror syncing..." cd $backupfoldermirror lftp -e "open ftp://${dbuser}:${dbpwd}@${dbhost} && mirror --no-perms --exclude-glob backup_scripts/ --exclude-glob cache/ --exclude-glob LocalSettings.php --parallel=10 && bye" } compress_base () { echo "Compressing current..." DIFF=`diff -q -r $backupfoldermirror $backupfoldercurrent` echo -e "Difference between sync and current is:\n$DIFF" DIFFARR=($DIFF) LENDIFFARR=${#DIFFARR[@]} if [ "$LENDIFFARR" -gt "0" ] then rm -rf $backupfoldercurrent cp -p -r $backupfoldermirror $backupfoldercurrent tar -zcf ${backupfolder}/ftpdump_${mydate}.tar.gz $backupfoldercurrent/ fi } dump_base ; exec_test compress_base ; exec_test echo "Done, quit!" _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list relax-devel@xxxxxxx To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-devel