07.05.08
Posted in Bash, Tips at 11:15 am by Guy
This is a small script I’ve written to automate my server-side backups of my blogs. It creates a backup of both the database and the actual WordPress files.
#!/bin/bash
# (C) 2008 Guy Rutenberg - http://www.guyrutenberg.com
# This is a script that creates backups of blogs.
DB_NAME=guy_blog
DB_USER=guy_root
DB_PASS=****
DB_HOST=localhost
#no trailing slash
BLOG_DIR=/home/guyru/guyrutenberg.com
BACKUP_DIR=/home/guyru/backups
echo -n "dumping database... "
mysqldump --user=${DB_USER}|> --password=${DB_PASS}|> --host=${DB_HOST}|> ${DB_NAME}|> \
| bzip2 -c > ${BACKUP_DIR}|>/${DB_NAME}|>-$(date +%Y%m%d).sql.bz2
if [ "$?" -ne "0" ]; then
echo -e "\nmysqldump failed!"
exit 1
fi
echo "done"
echo -n "Creating tarball... "
tar -cjf ${BACKUP_DIR}|>/${BLOG_DIR##*/}-$(date +%Y%m%d).tar.bz2 ${BLOG_DIR}
if [ "$?" -ne "0" ]; then
echo -e "\ntarball creation failed!"
exit 1
fi
echo "done"
Read the rest of this entry »
Permalink
11.03.08
Posted in Bash, Projects at 11:47 pm by Guy
I’ve decided to scan some notebooks. After researching a bit, I’ve decided to use DjVu (instead of PDF which I normally use). I’ve chose to use DjVu because it offered great quality with very good compression rate (~26KB per page) in lineart (black and white).
While XSane can natively save a multipage project into PDF it can’t do so for DjVu. So, the solution is to use the PNMs generated by XSane and convert them using the command line tools offered by DjVuLibre to bundle them together to a DjVu file. As you can guess doing this manually is pretty hard work. To make this task easier I’ve written a small bash script to automate the process.
Read the rest of this entry »
Permalink
01.03.08
Posted in Bash, Linux, Projects, Tips at 11:12 pm by Guy
This is a small script I wrote today, to automate my backups, which I do on Amazon S3. This is fairly short, yet useful bash script that utilize the s3cmd to do the actual sending of the files.
Read the rest of this entry »
Permalink