Subject: Re: [vserver] Conditional start
From: "Daniel Hokka Zakrisson" <daniel@hozac.com>
Date: Tue, 2 Sep 2008 23:41:56 +0200 (CEST)

Gilles Sadowski wrote:
>
>> > How can make it so that "vserver <vsname> start" checks that some condition
>> > is fulfilled before actually starting the vserver?
>>
>> Put a script in /etc/vservers/<guest>/scripts/initialize.d/<whatever>, make sure
it's
>> not executable, and exit 1 if your conditions are not met.
>>
>
> It seems that "script" here means "bash" only (?).
> At least, I tried with a Perl script, and got this message:

If you don't want to use bash, make the script executable. It should still do the right
thing, it's just not as obvious as if it's not executable :-)

> # vserver i386 start
> /etc/vservers/i386/scripts/initialize.d/isLvmDeviceAvailable.pl: line 3: use: command
not
> found
>
>
> Failed to start vserver 'i386'
>
> So the program that starts those scripts seems to ignore the
> #!/usr/bin/perl -w
> line at the top of the file.

Well, yes, if it's not executable, it cannot be executed, and sourcing it is the only
option.

-- 
Daniel Hokka Zakrisson