Add quick and dirty mysql backup script to personal personal-scripts
authorSam Hart <criswellious@gmail.com>
Fri May 09 10:57:46 2008 -0400 (2 months ago)
branchpersonal-scripts
changeset 493c1e25e76f4d
parent 4819d9647d0639
child 507dfbe97f63a7
Add quick and dirty mysql backup script to personal
trunk/basic_image_finder.py
trunk/qnd-mysql-backup.sh
       1 --- a/trunk/basic_image_finder.py	Sun Apr 27 21:16:59 2008 -0400
       2 +++ b/trunk/basic_image_finder.py	Fri May 09 10:57:46 2008 -0400
       3 @@ -31,4 +31,5 @@
       4  root = "/home/sam/images"
       5  
       6  os.path.walk(root, visit, arg)
       7 -print arg.results
       8 \ No newline at end of file
       9 +print arg.results
      10 +print arg.results.keys()
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/trunk/qnd-mysql-backup.sh	Fri May 09 10:57:46 2008 -0400
     1.3 @@ -0,0 +1,32 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# A quick and dirty mysql backup tool
     1.7 +
     1.8 +# date +%Y-%m-%d_%H:%M:%S
     1.9 +
    1.10 +LOG_FILE="/var/log/qnd-mysql-backup.log"
    1.11 +
    1.12 +trace () {
    1.13 +    stamp=`date +%Y-%m-%d_%H:%M:%S`
    1.14 +    echo "$stamp: $*" >> $LOG_FILE
    1.15 +}
    1.16 +
    1.17 +ALL_DBS=$(cat <<EOF
    1.18 +list
    1.19 +of
    1.20 +databases
    1.21 +EOF
    1.22 +)
    1.23 +
    1.24 +DEST_DIR="/path/to/backups/"
    1.25 +
    1.26 +trace "qnd-mysql-backup started"
    1.27 +
    1.28 +for a in $ALL_DBS
    1.29 +do
    1.30 +    trace "Working database: $a"
    1.31 +    mysqlhotcopy $a $DEST_DIR >> $LOG_FILE 2>&1
    1.32 +done
    1.33 +
    1.34 +trace "qnd-mysql-backup done"
    1.35 +trace "---------------------"