-#!/bin/bash -x
+#!/bin/bash
# based on Tony Risinger code from lxc-users
# http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg00074.html
-which inotifywait || apt-get install inotify-tools
+which inotifywait >/dev/null || apt-get install inotify-tools
-name=llin
+name=$1
-#lxc-info -n $name | grep RUNNING && exit
+if [ ! -e /var/lib/lxc/$name/config ] ; then
+ echo "Usage: $0 name"
+ ls /var/lib/lxc/*/config | cut -d/ -f5
+ exit 1
+fi
rootfs=`grep lxc.rootfs /var/lib/lxc/$name/config | cut -d= -f2`
echo "$name rootfs $rootfs"
-# fix lxc-stop which remounts ro
-mount /mnt/llin -o remount,rw
-
-lxc-start -d -n $name -o /tmp/${name}.log
+lxc-info -n $name | grep RUNNING || lxc-start -d -n $name -o /tmp/${name}.log && echo "$name start"
while true; do
# time of 5 minutes on it JUST IN CASE...