Ghislain wrote:
> Le 10/04/2010 12:10, Eugen Leitl a écrit :
>> I'm processing /24 worth of vservers at a time via a noninteractive script,
>> and unfortunately can't make exec export DEBIAN_FRONTEND=noninteractive
>> stick. How are you doing it?
>>
>> The script I use, called as e.g. ./modall.sh 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 export DEBIAN_FRONTEND=noninteractive
>> vserver v${1} exec apt-get -y --force-yes install locales nginx postfix
>> vserver v${1} hashify
>> }
>>
>> for i in `seq $IPstart $IPend`;
>> do
>> process $i
>> done
>>
>> The error I'm getting is vcontext: execvp("export"): No such file or directory
>> Using just DEBIAN_FRONTEND=noninteractive is no good either, and there's
>> no way to execute multiple commands in one line with vserver exec
>>
>> Do I have to build a script in each vserver and call it? If yes, can someone
>> post a recipe for that? Thanks.
>>
>>
>
> had you try to put all on a script and launch the script with vserver exec ?
>
> #!/bin/bash
>
> apt-get update
> export DEBIAN_FRONTEND=noninteractive
> apt-get -y --force-yes install locales nginx postfix
>
>
Hi,
To complete what Ghislain wrote:
When you call "vserver $vs exec something" it launch a shell witch is
destructed after the command finishs. And, so the vars you set in are losts.
I gess that the export don't work for the same reason that
"chroot /foo export" do'nt: it bypass the shell calling (and so export
is not reconized as a valid command as it is a shell build-in).
So,
- a script should works
- And "vserver $vs exec sh -c 'export FOO=bar; apt-get foobar;'" should
also.
Regards,
-- Mathieu Goessens IT consultant. gebura@poolp.org + 33 6 07 91 54 87 http://gebura.eu.orgReceived on Sat Apr 10 12:13:46 2010