Guest Posted September 23, 2009 Share Posted September 23, 2009 (edited) Hello, I'm add this contribution simple because I use it. This script already on my computer for ages and I got it from another place. But since the original author not mentioned on the script, so I can not said who is he/she. :( The credit should go to "John Doe" or "Jane Doe", not me. The contribution uploaded at: http://addons.oscommerce.com/info/7034 Edited September 23, 2009 by midave Quote Link to comment Share on other sites More sharing options...
bemi Posted September 24, 2009 Share Posted September 24, 2009 i think there is a mistake: case ($size>=1024); $size = round($size/1024) . " KB"; break; should be case ($size>=1024): $size = round($size/1024) . " KB"; break; Quote Link to comment Share on other sites More sharing options...
Guest Posted September 24, 2009 Share Posted September 24, 2009 Thank you for your correction. It is corrected now and uploaded. Quote Link to comment Share on other sites More sharing options...
bemi Posted September 25, 2009 Share Posted September 25, 2009 here's an improved script...maybe :) got some trouble on my server using your script. the base of this script i found on the internet (long time ago) too and did some modifcations. #!/bin/bash KEEP=31 # number of backups to keep USER='user' # database user PASS='pass' # database password DB='db' # select the database to backup, or... #DB='--all-databases' # backup all databases (comment the line above) BUPATH='/root/backup_etkatalog/db_backups' # path to this (!!) script BACKUPS=`find $BUPATH -name $DB"-*.sql.gz" | wc -l | sed 's/\ //g'` while [ $BACKUPS -ge $KEEP ] do ls -tr1 $BUPATH/$DB-*.sql.gz | head -n 1 | xargs rm -f BACKUPS=`expr $BACKUPS - 1` done DATE=`date +%Y%m%d%H%M%S` rm -f $BUPATH/.$DB-${DATE}.sql.gz_TMP /usr/bin/mysqldump $DB --opt -Q -u$USER -p$PASS | gzip -c -9 > $BUPATH/.$DB-${DATE}.sql.gz_TMP mv -f $BUPATH/.$DB-${DATE}.sql.gz_TMP $BUPATH/$DB-${DATE}.sql.gz exit 0 # example for daily backup (00:01) # ================================ # add this line to crontab # 1 0 * * * root sh /path/to/this/script.sh Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.