WordPress Permalink formats

Having just moved my WordPress blog to OpenShift, it’s amazing how many settings apparently I had tweaked and customized on my previous site. I just followed a Google search link to one of my own posts and got a 404, and realized that the link format to my posts had changed.

I used to have links like /year/month/day/postname and now only URLs that looked like ?p=number. The first format is one of the Permalink formats. You can customize this in Settings/Permalinks. More info here.

Useful Photoshop Elements shortcuts and tips

Cmd-T : resize current selection

Cmd-I : inverse mask selection

Copy mask to another layer: Cmd-click a mask to select (the mask outline in the layer view). Copy, select other layer, paste.

x – toggles foreground and background colors.

b – select brush

[ ] – increase / decrease brush size

This series of tutorial videos is probably the best I’ve come across so far, very clearly explained.

The best tip ever for layer masks! : “White reveals, Black Conceals”

 

Another server drive failure – so migrated my WordPress blog to OpenShift

So it happened. Again. Although the last time was at least 5 years ago. A ton of i/o errors in syslog, and one of my drives in a RAID1 array is not responding. Strangely the other drive although still working is reporting in SMART that it is also about to die. That seems unlikely to have two drives go at the same time?

SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.

Uh-oh.

So here’s the deal. The last time, roughly 5 years ago, I had a drive completely die and my Ubuntu server than I run from home wouldn’t boot. I lost several months of blog posts and notes. When I rebuilt it, I installed a pair of 250GB Hitachi Deskstar P7K500 drives in RAID1 configuration. The odd thing is that one of the drives kept dropping out of the array every few months in the last year, but it could be added back with the mdadm commands so I didn’t think much of it. Maybe I should have looked more closely in the logs what was going on.

So I’m at the decision point. Probably shouldn’t just replace one of the drives if one is alreay bad, should probably replace them both. Do I want to spend a couple of hundred on another pair of drives? At least the RAID array probably saved me from completely losing everything again.

I’ve run my own Linux server from home since about 2000. It’s physically changed motherboards a couple of times, its been a PIII and most recently a P4 with just 512MB of RAM and I’ve run JBoss versions from 3.x or so upto 5.x, Glassfish 3.x, I’ve run my blog on on my own custom app (BBWeblog), then Drupal, Joomla, and most recently WordPress on Apache. I’ve enjoyed running my own server since it means I can do whatever I like with it, and other than the cost for the hardware, there’s no hosting costs for my sites.

I think it’s reached the point though where enough is enough. Time to move online somewhere. Given that I’ve been using OpenShift for a number of projects at work, it seemed an easy choice to spin up a gear using the WordPress template and just import my site. And it only took a couple of minutes to get it up and running. I spent more time playing around with the WordPress Themes than I did actually setting it up and importing my site.

The only slightly tricky part was to update the DNS entry to point to OpenShift, which involved the following steps:

  • Update my record on zoneedit.com to delete the entry for my domain. I’ve been using ZoneEdit because they support Dynamic IP addresses by giving you a script to run locally to update what your actual IP address is periodically.
  • Update my GoDaddy account to remove the ZoneEdit DNS servers, switch from Custom DNS settings to Standard, click on DNS Zone File, and then add a CNAME record for ‘www’ pointing to my apps’s URL on OpenShift
  • Back to OpenShift, run ‘rhc add-alias wordpress www.kevinhooke.com’ where wordpress is the name of my app.

This post was useful, and here’s the docs for ‘rhc add-alias’

Done! It actually only took a couple of minutes for the changes to get reflected too, i.e. if I ping www.kevinhooke.com it’s now picking up the new IP for my OpenShift server on AWS.

I’m probably still going to play around with some customization options on WordPress, but  from start to finish it was probably less than an hour. It would have taken me far much longer than that to install new drives in my server, reinstall from a drive image, and get it all set up again. So, fingers crossed, here’s looking forward to my new home on OpenShift 🙂

Combining find and grep

Quick note to remember this syntax as every few months I find a need to do a grep within a number of files:

find -name "pattern" -exec grep "pattern" {} ;

Grep options:
-H print filename in results
-n print line number where match was found
-l limit match to first found match in file (useful if you want to find files containing a match but don’t care how many matches are in each file)

Pipe to wc -l to count file occurrences, eg:

find -name "pattern" -exec grep -l "pattern" {} ; | wc -l

Use egrep if you need to use regex in the pattern.