cleanup output

This commit is contained in:
Anthony Young 2011-09-13 21:51:28 -07:00
parent 1c36464615
commit 4f27922342

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Configurable params # Configurable params
BRIDGE=${BRIDGE:-br0} BRIDGE=${BRIDGE:-br0}
CONTAINER=${CONTAINER:-STACK} CONTAINER=${CONTAINER:-STACK}
@ -12,6 +12,11 @@ COPYENV=${COPYENV:-1}
# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova" # Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
STACKSH_PARAMS=${STACKSH_PARAMS:-} STACKSH_PARAMS=${STACKSH_PARAMS:-}
# Install cgroup-bin if we don't have it yet
if ! which cgdelete | grep -q cgdelete; then
apt-get install cgroup-bin
fi
# Create lxc configuration # Create lxc configuration
LXC_CONF=/tmp/$CONTAINER.conf LXC_CONF=/tmp/$CONTAINER.conf
cat > $LXC_CONF <<EOF cat > $LXC_CONF <<EOF
@ -26,8 +31,10 @@ EOF
# Shutdown any existing container # Shutdown any existing container
lxc-stop -n $CONTAINER lxc-stop -n $CONTAINER
# This prevents zombie containers # This kills zombie containers
cgdelete -r cpu,net_cls:$CONTAINER if [ -d /cgroup/$CONTAINER ]; then
cgdelete -r cpu,net_cls:$CONTAINER
fi
# Warm the base image on first install # Warm the base image on first install
CACHEDIR=/var/cache/lxc/natty/rootfs-amd64 CACHEDIR=/var/cache/lxc/natty/rootfs-amd64
@ -113,8 +120,10 @@ cat > $RC_LOCAL <<EOF
EOF EOF
# Configure cgroup directory # Configure cgroup directory
mkdir -p /cgroup if ! mount | grep -q cgroup; then
mount none -t cgroup /cgroup mkdir -p /cgroup
mount none -t cgroup /cgroup
fi
# Start our container # Start our container
lxc-start -d -n $CONTAINER lxc-start -d -n $CONTAINER