One of the tools I use to keep my BrickLink and BrickOwl LEGO inventories in sync is a piece of software called BrickSync.

BrickSync is a utility that scans for new orders on both BrickLink and BrickOwl and will make the necessary inventory adjustments when new orders arrive.

I keep the BrickSync software running on a Linode (referral link) virtual machine in a screen session. Here are some notes on how I set that up.

Installing and Configuring BrickSync on Linux

  1. Download the latest version of BrickSync from http://www.bricksync.net/
  2. Unzip the installation file into a directory on the server * You can use the gzip -xzvf <bricksync gzip file> to extract the package contents * I will tend to keep the latest version of bricksync around on the server just in case.
  3. Get a BrickLink API key for your server's IP address and put it in BrickSync's data/bricksync.conf.txt file
  4. Get a BrickOwl API key and put it in BrickSync's data/bricksync.conf.txt file
  5. Test that bricksync runs without errors by issuing the ./bricksync command from within the BrickSync install directory

Running BrickSync in a screen session

BrickSync runs as a command line program, but I want to be able to log into my server and do other things. So I use the screen utility to run BrickSync in a separate shell window that I can attach to and detach from as needed.

To run BrickSync in a screen session, you can use this command from the install directory:

screen -S bricksync ./bricksync

To detach from the screen session, use CTRL-A CTRL-D

To see a list of current screen sessions, use screen -ls

To reattach to the BrickSync screen session, use screen -r bricksync

Automatically starting BrickSync after reboot

I want to start bricksync automatically after a reboot and run it in a detached screen session. I do this by putting the commands for starting bricksync in a screen session into a shell script and then calling that shell script after a reboot using a cron job.

Contents of the shell script:

(cd <path to bricksync> && exec screen -S bricksync -d -m ./bricksync)

This command changes the working directory to the bricksync directory and start a detached screen session with a session name of bricksync that runs the bricksync program.

The cron job is configured with crontab -e and adding the following line:

@reboot sleep 30 && <path to shell command>