Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, June 26, 2007

plr for postgres 8.2 on Ubuntu Feisty using Gutsy deb-src

The only reason I have not upgraded to postgresql 8.2 is lack of a plr package.

After yesterday's dissection of the plr install for postgres 8.1, I decided to create a 8.2 install.

I noticed plr 8.2 is already available for Gutsy (which is still in development at the time of this writing).
http://packages.ubuntu.com/gutsy/libs/postgresql-8.2-plr

So I tried the Gutsy .deb (binary), but it would not install b/c of a unmet gcc dependency. So I tried building it from the deb sources, but plr.c would not compile as is. After hacking around I was able to get it to build.

Using Gutsy deb-src to build a Feisty .deb (binary) for postgesql 8.2 plr
$ wget http://mirrors.easynews.com/linux/ubuntu/pool/universe/p/plr/plr_8.2.0.1-1.diff.gz
$ wget http://mirrors.easynews.com/linux/ubuntu/pool/universe/p/plr/plr_8.2.0.1-1.dsc
$ wget http://mirrors.easynews.com/linux/ubuntu/pool/universe/p/plr/plr_8.2.0.1.orig.tar.gz
$ dpkg-source -x plr_8.2.0.1-1.dsc
$ cd plr-8.2.0.1
$ vi +185 plr.h

Remove the ", R_NilValue" from the end of the line. Line should read:
#define R_PARSEVECTOR(a_, b_, c_) R_ParseVector(a_, b_, (ParseStatus *) c_)
$ dpkg-buildpackage -rfakeroot -b
$ cd ..
$ sudo dpkg --install postgresql-8.2-plr_8.2.0.1-1_amd64.deb

Monday, June 25, 2007

Transfering multiple files with netcat

Today I needed to backup some files from one server to another. The servers sit next to one another on the network. Usually I use scp or rsync to move files around, but today I felt like trying something different.

First I considered using FTP. However, I do not like running FTP servers and didn't feel like configuring the daemon.

Then I thought of netcat. A quick Google search got me this page: http://www.oreillynet.com/pub/h/1058

However I want to transfer multiple files (all in the same directory). So I decided to use tar, and instead of creating a file, I would pipe it's output through netcat.

On the Receiving Computer (Server):
nc -v -w 30 -p 5600 -l | tar -x


And on the Sending Computer (Client):
tar -c * | netcat -v -w 2 10.0.0.2 5600;


The files transfered fast (2 min 20 seconds for 1.6 Gigs). I ran a md5sum on the client and server to confirm, and everything was perfect.