Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Using grep to scrape web pages

In preperation to scrape a number of web pages, I used grep to make a list of URLs I need to scrape. The list of URLs was in an RSS file.

grep -P “\<link><\![CDATA\[(.*?)]” hawkeye_stories.xml > hawkeye_stories_links.txt

Bash script to backup a WordPress web site

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 […]

Don’t upgrade yet!

I know how tempting it is to press that upgrade button, but don’t do it without backing up those files. Backing up your files first is just too quick and easy to skip when doing it from the command line. Here’s how:

Backup your MySQL database DATE=`date | tr ” ” _` mysqldump -u root […]

Linux and Apache commands

Here are some commands that we use at the Gazette on our Linux web server. It is running Red Hat Enterprise Linux 5.2.

Reload Apache Conf file /etc/init.d/httpd reload

Restart Apache apachectl -k graceful (didn’t work on Rackspace)

Restart Apache from ssh /etc/rc.d/init.d/httpd restart

Modify Apache conf file vi /etc/httpd/conf/httpd.conf

vi commands i enter edit […]