Monday, March 20, 2006

Sniping eBay Auctions with esniper on FreeBSD

I've been using esniper to automatically place bids on eBay for a couple months now, and it's worked flawlessly. Check the esniper web site for information on what sniping is, amongst other related questions. They explain that well, I won't duplicate their explanation here.

So what does
esniper do?
In a nutshell, esniper allows you to bid your maximum amount at the last second, either on a single item, or on a list of items. I use it for lists as much as anything, because I'm frequently looking for multiple identical items, like 5 of switch model X, or 7 of router model Y, etc. I can define a quantity in the auction file, then put in a list of auction numbers and my max price, and it will automatically bid until I have won the desired quantity (or it reaches the end of my list of items).

Installing esniper on FreeBSD
esniper can be found in the FreeBSD ports collection under /usr/ports/misc/esniper. To install:

cd /usr/ports/misc/esniper && make install clean

Using esniper on FreeBSD
First, you need to create a .esniper file in your home directory (note the leading dot) containing some configuration information.

Here is the ~/.esniper file I use:
# A configuration file contains option settings,
# blank lines, and comments (begin with #). The
# default configuration file is $HOME/.esniper, and
# if you specify an auction file, .esniper in the
# auction file's directory as well. If you specify a
# configuration file using the -c command-line option,
# then that configuration file will be the only one
# read.
#
# If you set your password in a configuration file
# and you are on a unix system, you should be the
# owner of the file, and you should set the
# permissions so that it is readable only by the
# owner.
#
# Here are all the options. Note that if the
# default (as defined in esniper -H) is fine, you
# don't need to specify it in a configuration file.

# boolean parameters can be set to:
# true, y, yes, on, 1, enabled
# false, n, no, off, 0, disabled
batch = false
bid = yes
debug = enabled
reduce = y
username = EBAYUSERNAME
password = EBAYPASSWORD
logdir=~/esniper/logs

# Note: quantity is usually set in an auction file
quantity = 1
# Note: seconds can also be "now", if you want to
# bid immediately
seconds = 10
Replace EBAYUSERNAME with your eBay user name, and EBAYPASSWORD with your eBay password. The quantity above is the default quantity, and seconds is how long before the end of the auction that esniper will put in your bid by default. You can change "bid = no" if you just want to see what it would do, rather than letting it start bidding.

I create ~/esniper/ and ~/esniper/logs/ directories, and put auction files in ~/esniper/ and the above .esniper file sends logs to ~/esniper/logs/. Make sure you 'chmod 600 ~/.esniper' after you create the file, to help protect it from other users since it contains your plain text eBay password.

Also check the sample configuration from the esniper web site.

Creating an Auction File
For each type of item you wish to bid on, you need to first create an auction file. I call it something that makes sense to me, based upon the items within it. You can call it whatever you like.

You define the quantity of items you want, the auction numbers you want to bid on, and the dollar amount of the bid to place.

See the sample auction file on the esniper website for details.

Starting esniper
Once you have your configuration file and auction file created, you can run esniper. To run it using the auction file "my-auction-file.txt" in ~/esniper/:

$ esniper ~/esniper/my-router-auction-file.txt

And let it run, it will check with eBay periodically and place your bid at the time you defined in your .esniper file.

Have fun!