Add a Virtual IP Address in Linux

nano /etc/sysconfig/network-scripts/ifcfg-eth0

Should look something like this


DEVICE=eth0
BOOTPROTO=static
BROADCAST=172.16.0.255
HWADDR=00:00:00:00:00:00
IPADDR=172.16.0.2
NETMASK=255.255.255.0
NETWORK=172.16.0.0
ONBOOT=yes

Duplicate that and open the new file

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
nano /etc/sysconfig/network-scripts/ifcfg-eth0:0

Change device name, set new IP, remove reference to hardware


DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=172.16.0.255
IPADDR=172.16.0.3
NETMASK=255.255.255.0
NETWORK=172.16.0.0
ONBOOT=yes

Use cURL instead of wget on Mac OS X

I use wget all the time on my Linux machines, but was surprised to find it missing on my MacBook Pro. Since Mac OS is based on BSD, it uses cURL instead. Here’s a good way to scrape files from a remote server.

curl -O http://www.gutenberg.org/files/21171/mp3/21171-[01-24].mp3

Man page is available at: http://curl.haxx.se/docs/manpage.html

Pause a Linux Shell Script using Sleep

It’s easy to pause a shell script during execution. Just add:

sleep 10

(where 10 is the number of seconds you want the script to pause.)

Some code for testing would be…

#!/bin/sh
before="$(date +%s)"
echo $before
sleep 3
after="$(date +%s)"
echo $after
elapsed_seconds="$(expr $after - $before)"
echo Elapsed time for code block: $elapsed_seconds

Have other ideas? Please comment.

iPhone Gripes

After playing with an iPhone for a few weeks, here are a few of my biggest gripes:

  • Shorter battery life than my Blackberry
  • Slower email composition (more steps)
  • No keyboard shortcuts
  • No consolidated Inbox
  • Ergonomics: isn’t as comfortable in my hand
  • No visual indicator for waiting email/voicemail without checking screen
  • No voice dialing
  • No chat