Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jul 2019 18:24:31 +0200
From:      Luca Pizzamiglio <pizzamig@freebsd.org>
To:        James Gritton <jamie@gritton.org>
Cc:        jail@freebsd.org
Subject:   Re: Defaults in jail.conf not applied if jail block is not existing
Message-ID:  <CAB88xy8QXryqjQSip8NFHO8Hi00_=E961XJEN3j-sCTWZdN6fg@mail.gmail.com>
In-Reply-To: <CAOq6ouf7QZy9We4swudbsDiMT60Jbr-Z52=BuN4qGgfgxuohgQ@mail.gmail.com>
References:  <CAB88xy9Vw%2BXzw7hAg_6i=bo6TUSXoBAvE6DXe_iCo=N2Nm3Wjw@mail.gmail.com> <CAOq6ouf7QZy9We4swudbsDiMT60Jbr-Z52=BuN4qGgfgxuohgQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Jamie,
Thanks for the quick answer. I guess I have to decide to go full
command-line or full jail.conf.
The devctl patch seems pretty cool. Actually, I like the idea to have a
jaild daemon that take care of all the pre/post start/stop stuff, doable if
the devctl notifications system is in place, but it adds more complexity.
Probably, it's something I can work on in the future, even if it can
overlap with what an orchestrator does.

Thanks again for the support
Best regards,
pizzamig@

On Sat, Jul 20, 2019 at 12:01 AM James Gritton <jamie@gritton.org> wrote:

> If I'm reading it right, then yes the behavior on creating jails if
> intended.  The defaults in jail.conf are only defaults to the jails listed
> in jail.conf, not defaults to command-line-generated jails.  So even if you
> only include an empty block for the jail, it then is a jail.conf jail and
> not a command-line jail.
>
> For the non-persistent jail poststop scripts, the only way to run them
> outside the jail is to have a process outside the jail to run them from.
> Cron isn't a perfect solution, but a pretty workable one.  If your jail has
> a single process that runs from start to finish (i.e. not something like a
> typical "command=sh /etc/rc"), then you could simply have a subshell that
> runs the jail and then runs the poststop script itself:
> # (jail -c name=foo command=sleep 10; echo doing cleanup) &
>
> You may be interested in the suggested patch for jail notifications in
> devctl.  That way, a jail-watch process can tell when jails start and stop.
>
> - Jamie
>
> On Fri, Jul 19, 2019 at 10:29 AM Luca Pizzamiglio <pizzamig@freebsd.org>
> wrote:
>
>> Hi all,
>>
>> I have 2 silly questions and I think I know the answer.
>> I'd like to use the command line jail tool start and configure my jails;
>> however, I'd like to have defaults set up in a central place.
>>
>> I thought I could put those defaults in /etc/jail.conf and then
>> dynamically
>> create my jails with the cli tool.
>> However, if the jail create (or stop) is not explicitly listed in
>> jail.conf, the defaults are not applied.
>> If I add an empty configuration block, then the default values are
>> applied.
>>
>> Is this an intended behavior?
>>
>> The second question is about not persistent jails.
>> Once all processes in the jail exits, the jail is automatically destroyed.
>> However, without invoking jail -r , there is no way (that I'm aware of) to
>> invoke a poststop script automatically.
>> Is there a workaround or a suggested way to have a callback/script invoked
>> when a jail disappear? (currently, I'm not happily considering a cronjob
>> as
>> a solution)
>>
>> Thanks in advance for the support!
>>
>> Best regards.
>> pizzamig@
>> _______________________________________________
>> freebsd-jail@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-jail
>> To unsubscribe, send any mail to "freebsd-jail-unsubscribe@freebsd.org"
>>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB88xy8QXryqjQSip8NFHO8Hi00_=E961XJEN3j-sCTWZdN6fg>