Re: [vserver] hashify cleanup

From: Eugen Leitl <eugen_at_leitl.org>
Date: Mon 12 Apr 2010 - 11:56:22 BST
Message-ID: <20100412105622.GD1964@leitl.org>

On Mon, Apr 12, 2010 at 09:10:30AM +0200, Ghislain wrote:

> then you should have /var/lib/vservers and not /vservers. The '-debian'

I can nuke /vservers completely on a Debian machine, correct?

> tools are compiled for vservers in the debian directory.
>
> see http://linux-vserver.org/util-vserver:Devdebianpackage

I've modified the vserver build/init script to address
Debian-specificities. If called as ./buildall 1 254
it builds 192.168.1.1 to 192.168.1.254 servers.

Does below make sense to you? Thanks!

#!/bin/sh
set -x
IPstart=$1
IPend=$2

mkdir -p /etc/vservers/.defaults/apps/vunify/hash
mkdir -p /var/lib/vservers/.hash
ln -s /var/lib/vservers/.hash /etc/vservers/.defaults/apps/vunify/hash/0

function buildvs(){
        vserver v${IP} build --force -n v${IP} --hostname v${IP}.ativel.com --context ${IP} --interface eth0:192.168.1.${IP}/24 -m debootstrap -- -d lenny
        echo ${IP} > /etc/vservers/v${IP}/context
        echo "default" > /etc/vservers/v${IP}/apps/init/mark
        vserver v${IP} start
        vserver v${IP} exec apt-get update
        vserver v${IP} exec apt-get -y install locales nginx
        vserver v${IP} exec apt-get -y upgrade
        mkdir -p /etc/vservers/v${IP}/apps/vunify
        vserver v${IP} hashify
}

for i in `seq $IPstart $IPend`;
do
        buildvs $i
done

find /var/lib/vservers/.hash -type f -links 1 -exec rm -v '{}' ';'

Here is the script to modify existing vservers, called e.g.
as ./modall 1 254 :

#!/bin/sh
set -x
IPstart=$1
IPend=$2

function process () {
        vserver v${1} restart
        vserver v${1} exec apt-get update
        vserver v${1} exec sh -c 'export DEBIAN_FRONTEND=noninteractive; apt-get -y --force-yes install locales nginx postfix;'
        vserver v${1} exec apt-get -y upgrade
        vserver v${1} hashify
}

for i in `seq $IPstart $IPend`;
do
        process $i
done

find /var/lib/vservers/.hash -type f -links 1 -exec rm -v '{}' ';'

-- 
Eugen* Leitl leitl http://leitl.org
______________________________________________________________
ICBM: 48.07100, 11.36820 http://www.ativel.com http://postbiota.org
8B29F6BE: 099D 78BA 2FD3 B014 B08A  7779 75B0 2443 8B29 F6BE
Received on Mon Apr 12 11:56:36 2010
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 12 Apr 2010 - 11:56:38 BST by hypermail 2.1.8