Going From DHCP To Static

To set up your NIC for DHCP edit /etc/network/interfaces to read:

auto eth0
iface eth0 inet static
address 192.168.1.20
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

To set up your NIC for DHCP edit /etc/network/interfaces to read:

auto eth0
iface eth0 inet dhcp

Of course you will need to adjust ethX for the particular NIC you are making changes for. Following this you will want to run:

sudo /etc/init.d/networking restart

SSH With No Password

In order to perform unattended backups I had to set up SSH to authenticate with no password. To do so, first generate a public key on the client side (the side that you will be logging in from).

ssh-keygen -t dsa

Then copy the id_dsa.pub to the .ssh directory on the remote machine (/home/you/.ssh -> create if necessary) and rename it to authorized_keys.

scp id_dsa.pub me@remote.com:/home/me/.ssh

Next time you login it should authenticate with out asking for a password.

Mounting A Windows Share

I installed xubuntu on a piece of crap rack mount at Surfx. I am dedicating it to synchronizing files with a remote server just in case something happens to our server. Anyways, in order to do this I had to learn how to mount a Windows share. It’s relatively painless.

First install samba…

sudo apt-get install samba
sudo apt-get install smbfs

Next, mount your share…

mount -t smbfs //Server/share /mount/point -o username=user,password=pwd

That’s really all there is to it. If you want to make it permanent then just add it to your /etc/fstab like so…

//Server/share /mount/point smbfs username=user,password=pwd 0 0

If, like me, you run across a situation where your share has a space in it you can solve that by using a ‘\ ‘ on the command line in place of the space or a ‘\040′ in the fstab file for a space char.

Run a…

sudo mount -a

to verify your fstab file immediately.

Combining PDFs

Need to combine multiple PDF’s into one? Use GPL Ghostscript! This simple command concatenates multiple PDF’s into one…

 gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH 1.pdf 2.pdf 3.pdf

Data Snapshot

As I stated a week back I changed hosting once again. I now have everything up on a virtual private server running Linux. With that I have secure shell access as well as 500 GB of storage. I decided to take advantage of this and create an automated backup script that would make and maintain a snapshot of my shared partition (where all my important data is). It turned out to be a really simple process using an application called rsync. The entire procedure is captured in one command line entry:

rsync -av --delete-after --stats --human-readable --modify-window=1 --exclude-from=/home/me/Scripts/rsyncexclude -e ssh /media/Shared/ me@mydomain.com:/home/me/backup/ > /home/me/Scripts/rsync-${TIMESTAMP}.log 2>&1

That bit takes all my data in /media/Shared/ and transfers it up to ~/backup/ via ssh while excluding any filters (*.mp3,*.iso). The output is redirected to an rsync log which will be emailed at the end using the sendEmail application. The –delete-after bit ensures that if the file is removed from the source it is also removed from the destination so I have a perfect snapshot. This script is run via cron so I don’t even have to worry about it’s execution. It’s automagic!

I’ve got two small problems with this. First, if I simply move a file on the source it will recognize this, delete it from the destination and re-upload it to the proper directory on the destination. This is obviously super inefficient. I need it to recognize this and perform a move operation instead of a put operation. I’ll work on this. Second, if I accidentally deleted all the files in the share it would delete all the files on the destination. I can mitigate this by using a command argument that halts the process if more than X files are to be deleted. However, I think a better solution is to create an automated script on the other side that will tar the files and archive them at 1month, 1 week and 1 day intervals.

I Love Ubuntu

I’ve played with different flavors of Linux in the past and it just never stuck (partly because I had no desire to learn). Recently I returned to Linux by dual booting one of my machines between XP and Ubuntu 8.04. I am completely sold on Ubuntu. It’s the greatest thing ever!

One of the major issues with switching OS’s is compatibility. For example, most of the business world operates off of MS Word or MS Excel. Well, the Linux community has produced a Microsoft Office equivalent in OpenOffice. It reads and writes .xls, .ppt, .doc etc. This is just one example but there are many other examples of Linux negating the compatibility issue.

For me, there are just two reasons why I can’t switch over completely Altium Designer and Solid Works. I must have my XP for these application and theres no getting around it (even with WINE). However, this will not stop me from making Ubuntu my primary OS and simply dual booting into XP when I need to use one of those two applications.

I Am Back BABY!

As George Costanza would say… “I am back baby”! I’ve been off the ice for well over a year. I just signed up for a league here in Anaheim and I am looking for a second at the moment. I’ve lost 15 pounds (yeah… I was getting fat) over the last 3 months so I should have no problems keeping up. Get some!