Archive for: August, 2009

Bash script to backup a WordPress web site

Aug 26 2009 Published by under Linux, Server Admin

The script (backup_site.sh) for backing up a site has been modified.  It now accepts parameters.

Parameter 1: domain
Parameter 2: database [optional]
Parameter 3: subdomain [optional]

Run as root

/home/root/sites/backup_site.sh gazlab.com matt_wp matt

#!/bin/bash

SITE=$1
SUBDOMAIN=$3
DBNAME=$2

if [ -z “$SUBDOMAIN” ]
then
if [ -z “$DBNAME” ]
then
mysqldump $DBNAME > /var/www/vhosts/$SITE/httpdocs/$DBNAME.sql
fi
tar -czvf $SITE.httpdocs.tar.gz /var/www/vhosts/$SITE/httpdocs
else
if [ -z “$DBNAME” ]
then
mysqldump $DBNAME > /var/www/vhosts/$SITE/subdomains/$SUBDOMAIN/httpdocs/$DBNAME.sql
fi
tar -czvf $SUBDOMAIN.$SITE.httpdocs.tar.gz /var/www/vhosts/$SITE/subdomains/$SUBDOMAIN/httpdocs
fi

exit 0

No responses yet

Saturday morning at Uncle Merlin’s lake

Aug 15 2009 Published by under Travel

No responses yet

is_home() not working in my WordPress plugin

Aug 04 2009 Published by under PHP, Wordpress

When using is_home(), is_category(), is_page() etc. in my WordPress plugin that displays category-based ads, they kept returning NULL.

My problem was that I was calling this these function directly in my plugin. I resolved this by adding these call to my adHeaderSetup() function and setting the hook add_action(‘wp_head’, ‘adHeaderSetup’);

No responses yet