add start/stop/restart single jail to /etc/rc.d/jail

Victor Balada Diaz victor at bsdes.net
Sat Jan 5 06:13:03 PST 2008


On Fri, Dec 28, 2007 at 10:36:57PM -0500, Kevin L. Kane wrote:
> I was getting very annoyed at the fact that when I do /etc/rc.d/jail
> restart it restarts all jails and there didnt seem to be an easy way
> to do that for only one jail on a machine.
> 
> The attached patch allows you to do
> /etc/rc.d/jail (stop/start/restart) (jailname)
> 
> Something that might need more thinking(this works well enough for me)
> but on stop it searchs the jail list for a jail referenced by
> jailname.  It then finds the JID based on hostname and issues jexec
> JID kill -TERM -1.  If your jls gets filled up with multiple entries
> for the same hostname it gets kinda broken, also if you have jails
> that do in fact have the same hostname you also get confusion.  Maybe
> it should match all fields instead of just hostname?


Hello Kevin,

you might want to take a look at FreeBSD's jail init script. It
allows to do what you want but doesn't have the problem with jails
that have the same name. Their solution is (was?) to save the ID
of the jail on a file when it boots and then use that to stop it.

I ported it sometime ago but at the time they had some security issues
with it and waited until they were sorted. Then i forget about the
changes and never committed it. If i recall correctly the
changes needed to jail(8) were committed, but if not, just tell me
and i'll take a look. The rest should be easy to port.

Regards.
-- 
La prueba más fehaciente de que existe vida inteligente en otros
planetas, es que no han intentado contactar con nosotros. 





More information about the Submit mailing list