Archive | System Administration

Killing a list of processes

I’m fighting with a MySQL server at the moment. It’s freshly compiled from source and I’ve followed all of my tried and tested instructions but it won’t start up properly and leaves a load of process hanging around that need killing before I can try starting it again. pkill wasn’t cutting it so I quickly [...]

Continue Reading

Debugging Javascript in IE7

Broken Javascript in IE *really* sucks as one gets really obscure error messages and alert(); becomes your only friend, or so I thought. I’ve recently done quite a lot of javascript DOM work for a site including some AJAX stuff and whilst it was a pleasure to develop in Firefox using Firebug, I’m now getting [...]

Continue Reading

Subversion repository creation shell script

I've updated my svn repository creation script, it now copies and imports the code. Works for me, etc. [code]#!/bin/sh # Darren Beale - siftware.co.uk # bealers@gmail.com # Oct 06 # v0.2 # This simple script creates a folder structure # containing /trunk /tags and /branches. It then places the # contents of a folder specified [...]

Continue Reading

Nightmare MySQL migration

I've been migrating a large number of websites over from one server to another, always an enjoyable task. So I get to the last one, copy the database over and do the normal mysql import along the lines of: [code]mysql -ufoo -pbar database_name < database_name.sql[/code] Errors++ Turns out the Donke^H^H^H^HDeveloper who built the application didn't [...]

Continue Reading

Excluding folders when creating a tarball

When creating a tarball, to exclude folders one simply uses the –exclude= flag: For example to tar up the contents of /var/log but to exclude /var/log/apache & /var/log/mail/ tar -jcvf logfiles.ta cheap viagra online without prescription r.bz2 /var/log/* –exclude=/var/log/apache/* –exclude=/var/log/mail/* Just in case you didn't already know then the 'j' flag in the 'jcvf' tells [...]

Continue Reading

Perl MySQL backup script.

I’m in the middle of migrating a lot of websites from one server to another. Here’s a small script I knocked up to take a dump of all the MySQL databases on that machine: [perl]#!/usr/bin/perl -w use strict; my $dumpDir = “/tmp/foo”; my $dumpUser= “root”; my $mysqlBin = “/usr/local/mysql/bin”; my $mysqlPassword = “bar”; foreach (`ls [...]

Continue Reading

Global search and replace using Vi

to replace all instances of – say – 127.0.0.1 with 10.0.0.1 in a file then using vi you can do: [code]:%s/127.0.0.1/10.0.0.1/g[ dating questions /code] if you mess it up then press u for undo. Of course if it's an important file then back it up first. zp8497586rq

Continue Reading