Archive for the ‘Unix’ Category

Reowning Ubuntu

Wednesday, August 15th, 2007

NFS is a pain because you need to have the same UIDs on different systems. It seemed easiest to change my UID on my Ubuntu box.

usermod -u 1234 phil

Simple enough and it even chowned the files in my home directory. But I still have files everywhere which have my old uid. I’d like to find and own them, seems like a pain, could take ages? Easy with GNU find:

sudo find / -uid 1000 -exec chown phil \{\} \;

Shutting down Windows

Tuesday, May 1st, 2007

My kids like to play games on my personal laptop which happens to have WinXP Home on it. Of course they don’t like to get off it when it’s time for dinner, bed, bathing, school, … Going in there and making them shut it down can be a challenge.

So the solution a mash-up Apache and psshutdown now available from Microsoft. My apache was installed through cygwin so I have all the shell powers available for my cgi scripts.
Just make some cgi scripts and off we go.

You will need to make a dummy script to accept the licence using the /accepteula switch which needs to be run once or the scripts will just all fail.

I added the sysinternals tools to my system environment path so they will get picked up without addng the path.

Then the following script is dropped into

/srv/www/cgi-bin/shutdown

#!/bin/sh

# disable filename globbing
set -f

echo “Content-type: text/plain; charset=iso-8859-1″
echo
echo Force shutdown of computer
echo

psshutdown -kf

I also set up a static IP address for the laptop.

Now I just put a bookmark in my browser http://192.168.1.199/cgi-bin/shutdown and clicking on this shuts that laptop down without any arguments.

I have Wi-Fi capable mobile phone so put the bookmark in there and I can easily shut it down from there too, which is really handy as I’m not always in front of a computer screen.

Start

Friday, February 2nd, 2007

I like to use a command line interface whenever possible. Sometimes though a windowed application is required. In MS Windows you use the start command to bring up the default app, (don’t use this much). In Cygwin I use the cygstart command.

So I was using my Ubuntu system and wanted to do something similar. The command it turns out is gnome-open. Bit of a mouthful so I have this aliased in my .bashrc file to cs for either cygstart or gnome-open which is much more snappy.

Pronethosting.net

Sunday, December 31st, 2006

Just renewed for another year with Pronethosting as my web/email/blog hosting provider.

They have been absolutely rock solid in the last year. I forget if I’ve been with them for three or four years now.

The plan provides everything you might want.

Here’s a snip from my plan details (linux 1)

150 MB web space
- 4000 MB transfer
- unlimited email
- webmail
- unlimited MY SQL
- PHP, Perl, SSH
- cPanel control panel
- Fantastico
- online statistics

The fantastico feature is really cool you can do things like almost one click install of Wordpress :-)

SSH is really nice as you can get down and dirty if you want to change/fix something if you want.

ImageMagick

Monday, January 9th, 2006

I had some jpeg images of a scanned document which I wanted to mail out to someone.  The obvious way to do this is as a pdf rather than make them open a new image for each page.  It turns out ImageMagick is rather good for this. My images are called pg01.jpg, pg02.jpg, and so on.  Type at the bash prompt the following:

$ convert -page A4+0+0 pg*.jpg doc.pdf

And the result is a single pdf with all the images in order. Ooops page 2 was upside down

$ convert -rotate180 pg2.jpg pg2a.jpg
$ rm pg2.jpg

Convert again as above and all done.

ImageMagick is available pretty much whatever you are running Windows, Cygwin, Mac, Linux, BSD, Solaris etc.