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
09.04.08
Posted in LaTex, Tips at 7:25 am by Guy
Recently I’ve worked on a Hebrew document in LaTeX and wanted to use the split environment to typeset some multiline formula. The document which compiled just fine till that point, failed to compile with the following error:
Package amsmath Error: \begin{split} won't work here.
Read the rest of this entry »
Permalink
28.03.08
Posted in Tips, vim at 11:26 pm by Guy
I started developing Google Gadgets for LabPixies, so one of the first thing I looked for was syntax highlighting. Vim recognized the gadgets’ code as XML file (which is correct), but I wanted also HTML syntax highlighting for the HTML part. So after searching a bit for some existing solution, I found one, but I didn’t like as it required me to wrap the HTML code with a specific comment. As I don’t like this kind of solution, I’ve decided to create my own syntax highlighting file for Vim.
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
01.02.08
Posted in Linux, Tips at 10:50 pm by Guy
Like many Linux users, I use Guarddog as a frontend to my iptables firewall. At some point, I noticed that Guarddog started acting strangely. Every time I restarted my computer, all internet traffic was blocked (both in and out). The only way to fix this situation was to open Guarddog and press “Apply” (without doing any changes). While it was annoying, it didn’t bother me much because I used to restart my computer about once a month. But few days ago, I decided to solve this problem once and for all.
Read the rest of this entry »
Permalink
18.01.08
Posted in Linux, Tips at 1:20 pm by Guy
Sometimes svn switch fails because unversion files exist in the working copy, and the need to erase them comes up. This is also true when updating to an old revision (usually one that misses directories that exist in the head revision), doing some work (like compiling), and then trying to update back to the head revision. Subversion (SVN) will fail complaining that directories/files already exist.
Read the rest of this entry »
Permalink