corz.org front page. welcome! cor's blog, aka 'corzblog'. I write stuff here.. downloads of all shapes and sizes, documents, secret chasms, you name it.. developing sites, software, stuff.. updates generally get posted here. music is everywhere, sometimes I pin it down.. soul-candy, captured things you can look at.. 'Mathematics For Women' copyright Cor 1994 ;o)
the power to serve, at home or anywhere. webmasters tricks, tips, tools and resources. the devil's work, or a capable multimedia desktop, you decide..
information and search
contact page for corz.org, ways to get $hit to me.. get a print friendly version of this page, probably.. Put YOUR money where MY mouth is!
 
corz.org text viewer..
[currently viewing: /public/linux/usr/local/bin/mysql_backup.sh - raw]
 
#!/bin/sh

# simple MySQL backup..
# backup a single database, gzipped to a date-named folder
# designed to be run twice per day (folders named am/pm)

# cron something like this..
# 0 0,12 * * * /home/corzorg/bin/mysql_backup.sh

# corz.org
# ;o)

# database details
username='corz_corzorg'
password='p4$$m03&'
database='corz_corzorg'

# main backup folder on web server
home='/bax'

# sub-folder for mysql backups
baxdir='mysql'

# if you alter this, test it.
d=`date +%y.%m.%d_%P`

cd $home
mkdir -p $baxdir/$d

  echo $database
  mysqldump --add-drop-table --allow-keywords --databases -q -a -c -u$username -p$password $database > $baxdir/$d/$database.sql
  rm -f $baxdir/$d/$database.sql.gz
  gzip -9 $baxdir/$d/$database.sql

# fin