3 # based on Tony Risinger code from lxc-users
4 # http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg00074.html
6 which inotifywait || apt-get install inotify-tools
10 #lxc-info -n $name | grep RUNNING && exit
12 rootfs=`grep lxc.rootfs /var/lib/lxc/$name/config | cut -d= -f2`
13 echo "$name rootfs $rootfs"
15 # fix lxc-stop which remounts ro
16 mount /mnt/llin -o remount,rw
18 lxc-start -d -n $name -o /tmp/${name}.log
21 # time of 5 minutes on it JUST IN CASE...
22 vps_utmp=${rootfs}/var/run/utmp
23 inotifywait -qqt 300 ${vps_utmp}
24 if [ $(wc -l < /cgroup/${name}/tasks) -eq 1 ]; then
26 runlevel="$(runlevel ${vps_utmp})"
27 echo "# $name runlevel $runlevel"
31 # nothing for new boot state
41 lxc-wait -n ${name} -s STOPPED
42 mount /mnt/llin -o remount,rw
43 lxc-start -d -n ${name} -o /tmp/${name}.log
46 # make sure vps is still running
47 state="$(lxc-info -n "${name}" | sed -e 's/.* is //')"
48 [ "$state" = "RUNNING" ] || break