September 2012

Simple helper scripts for managing lxc on Ubuntu

< class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-teaser">

The scripts are available at github. Only tested on Ubuntu 12.04 LTS.

As default (for my dev env) each container will get its own separate mounted /opt (under host's /opt/lxc/\) and /mnt/dbext4 (/mnt/dbext4/lxc/\) and /mnt/dbxfs (/mnt/dbxfs/lxc/\). Containers will be named as 'name-seqno'. Paths/defaults can be changed by editing etc/config. There are no shared disks between the containers. Install:

Tags: 

Add MongoDB repo for apt and/or yum (bash)

< class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-teaser">
#!/bin/bash

[ `whoami` != "root" ] && echo "Do: sudo $(basename $0)" && exit 1

install=$1

dist="Unknown"
regex_lsb="Description:[[:space:]]*([^ ]*)"
regex_etc="/etc/(.*)[-_]"

do_lsb () {
lsb=`lsb_release -d`
[[ $lsb =~ $regex_lsb ]] && dist=${BASH_REMATCH[1]} ; return 0
return 1
}

do_release_file () {
etc_files=`ls /etc/*[-_]{release,version} 2>/dev/null`
for file in $etc_files
do
  [[ $file =~ $regex_etc ]] && dist=${BASH_REMATCH[1]} ; break
done
}

if [ `command -v lsb_release` ]
then
  do_lsb
  [ $? -ne 0 ] && do_release_file
else

Tags: 

Unison OS X launchd plist

< class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-teaser">

unison_sync.sh

#!/bin/bash
pref=my_unison_pref
pid=`pgrep unison`

[ -z $pid ] && $HOME/bin/unison $pref -auto -batch

unison_sync.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>unison_sync</string>
    <key>ProgramArguments</key>
    <array>

Tags: 

Build unison 2.40.65 (ocaml 4.0) to work between Ubuntu 12.04 and OS X Mountain Lion

< class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-teaser">

I could not find any pre-built binaries (macports) that worked properly out of the box between my laptop and the ubuntu server. So build your own.

NOTE: This will break unison with hosts that use unison 2.40.65 built with ocaml 3.x!

Tags: