Archive for July, 2009
Quick ‘n’ Dirty MySQL Backups
By request, here’s the script I worked up to make periodic database dumps into a directory and gzip them up:
#!/bin/zsh
mysql_user=root
mysql_pass=your-root-password-here
bk_path='/where/to/put/the/dumps'
right_now=`date +"%Y%m%d-h%H"`
bk_fname="${bk_path}/full-db-dump.sql"
bk_gzname="${bk_path}/full-db-dump-${right_now}.sql.gz"
mysqldump -u"$mysql_user" -p"$mysql_pass" --all-databases > "${bk_fname}"
gzip -c "${bk_fname}" > "${bk_gzname}"
Running this as a cron job every [x] hours should be pretty good for small sites, especially if the archive directory is periodically rsynced to another remote host (as in my case).
For serious stuff, you may consider adding MySQL replication for continuous backup.
Oh, and since not everybody uses zsh, you can probably change the hash-bang to point to /bin/sh safely. I haven’t tried it myself, though.
Здравствуйте?
Here’s an interesting quickie: I’ve been getting a bunch (well, four so far, but far more than usual) of comments in Russian, all coming from the same IP that DomainTools says is in Ukraine — apparently, an ISP or something like that.
Now, the comment text, when run through Google Translate, reads pretty innocuous, but the activity smells spammy; and I can’t read Russian anyway, so I don’t want to approve what I don’t understand, either.
To the commenter(s) in question: I have only a slight idea of what you posted. I would prefer comments in English, or Romanian (if you speak that one). French is also an acceptable alternative. I’ll even try Spanish.
And if it’s spam, please just don’t bother — it’s useless!
